synonyms

package
v1.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 19 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package synonyms serves the Elasticsearch compatible synonyms sets API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteRule

func DeleteRule(c zhttp.Context)

DeleteRule deletes a synonym rule and reloads the analyzers using its set

@Id DeleteSynonymRule @Summary Delete synonym rule for compatible ES @security BasicAuth @Tags Synonyms @Produce json @Param id path string true "Synonyms set id" @Param rule path string true "Synonym rule id" @Success 200 {object} synonyms.UpdateResponse @Failure 404 {object} map[string]interface{} @Router /es/_synonyms/{id}/{rule} [delete]

func DeleteSet

func DeleteSet(c zhttp.Context)

DeleteSet deletes a synonyms set not used by any index

@Id DeleteSynonymsSet @Summary Delete synonyms set for compatible ES @security BasicAuth @Tags Synonyms @Produce json @Param id path string true "Synonyms set id" @Success 200 {object} map[string]interface{} @Failure 400 {object} map[string]interface{} @Failure 404 {object} map[string]interface{} @Router /es/_synonyms/{id} [delete]

func GetRule

func GetRule(c zhttp.Context)

GetRule returns a synonym rule of a synonyms set

@Id GetSynonymRule @Summary Get synonym rule for compatible ES @security BasicAuth @Tags Synonyms @Produce json @Param id path string true "Synonyms set id" @Param rule path string true "Synonym rule id" @Success 200 {object} meta.SynonymRule @Failure 404 {object} map[string]interface{} @Router /es/_synonyms/{id}/{rule} [get]

func GetSet

func GetSet(c zhttp.Context)

GetSet returns a page of the rules of a synonyms set

@Id GetSynonymsSet @Summary Get synonyms set for compatible ES @security BasicAuth @Tags Synonyms @Produce json @Param id path string true "Synonyms set id" @Param from query int false "Starting offset" minimum(0) @Param size query int false "Max results, default 10" minimum(0) @Success 200 {object} synonyms.SetResponse @Failure 400 {object} map[string]interface{} "Negative or non-integer from or size" @Failure 404 {object} map[string]interface{} @Router /es/_synonyms/{id} [get]

func ListSets

func ListSets(c zhttp.Context)

ListSets lists the synonyms sets sorted by id

@Id ListSynonymsSets @Summary List synonyms sets for compatible ES @security BasicAuth @Tags Synonyms @Produce json @Param from query int false "Starting offset" minimum(0) @Param size query int false "Max results, default 10" minimum(0) @Success 200 {object} synonyms.ListResponse @Failure 400 {object} map[string]interface{} @Router /es/_synonyms [get]

func PutRule

func PutRule(c zhttp.Context)

PutRule creates or updates a synonym rule, creating the synonyms set when missing, and reloads the analyzers using it

@Id PutSynonymRule @Summary Create or update synonym rule for compatible ES @security BasicAuth @Tags Synonyms @Accept json @Produce json @Param id path string true "Synonyms set id" @Param rule path string true "Synonym rule id" @Param data body meta.SynonymRule true "Synonym rule" @Success 200 {object} synonyms.UpdateResponse @Success 201 {object} synonyms.UpdateResponse @Failure 400 {object} map[string]interface{} @Router /es/_synonyms/{id}/{rule} [put]

func PutSet

func PutSet(c zhttp.Context)

PutSet creates or replaces a synonyms set and reloads the analyzers using it

@Id PutSynonymsSet @Summary Create or update synonyms set for compatible ES @security BasicAuth @Tags Synonyms @Accept json @Produce json @Param id path string true "Synonyms set id" @Param data body meta.SynonymSet true "Synonyms set" @Success 200 {object} synonyms.UpdateResponse @Success 201 {object} synonyms.UpdateResponse @Failure 400 {object} map[string]interface{} @Router /es/_synonyms/{id} [put]

func ReloadSearchAnalyzers

func ReloadSearchAnalyzers(c zhttp.Context)

ReloadSearchAnalyzers rebuilds the analyzers of an index, picking up changed synonyms sets and files

@Id ReloadSearchAnalyzers @Summary Reload search analyzers for compatible ES @security BasicAuth @Tags Synonyms @Produce json @Param index path string true "Index" @Success 200 {object} synonyms.ReloadDetails @Failure 404 {object} map[string]interface{} @Router /es/{index}/_reload_search_analyzers [post]

Types

type ListResponse

type ListResponse struct {
	Count   int          `json:"count"`
	Results []SetSummary `json:"results"`
}

ListResponse is a page of the synonyms sets.

type ReloadDetail

type ReloadDetail struct {
	Index             string   `json:"index"`
	ReloadedAnalyzers []string `json:"reloaded_analyzers"`
	ReloadedNodeIDs   []string `json:"reloaded_node_ids"`
}

ReloadDetail lists the reloaded analyzers of an index.

type ReloadDetails

type ReloadDetails struct {
	Shards        Shards         `json:"_shards"`
	ReloadDetails []ReloadDetail `json:"reload_details"`
}

ReloadDetails is the analyzers reload report of a change.

type SetResponse

type SetResponse struct {
	Count       int                `json:"count"`
	SynonymsSet []meta.SynonymRule `json:"synonyms_set"`
}

SetResponse is a page of the rules of a synonyms set.

type SetSummary

type SetSummary struct {
	SynonymsSet string `json:"synonyms_set"`
	Count       int    `json:"count"`
}

SetSummary is a synonyms set and its rules count.

type Shards

type Shards struct {
	Total      int `json:"total"`
	Successful int `json:"successful"`
	Failed     int `json:"failed"`
}

Shards counts the indexes whose analyzers were reloaded.

type UpdateResponse

type UpdateResponse struct {
	Result                 string        `json:"result"`
	ReloadAnalyzersDetails ReloadDetails `json:"reload_analyzers_details"`
}

UpdateResponse is the response of a synonyms set or rule change.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL