MCPcopy
hub / github.com/zincsearch/zincsearch / GetESAliases

Function GetESAliases

pkg/handlers/index/alias_es.go:117–135  ·  view source on GitHub ↗

@Id GetESAliases @Summary Get index alias for compatible ES @security BasicAuth @Tags Index @Produce json @Param target path string false "Target Index" @Param target_alias path string false "Target Alias" @Success 200 {object} map[string]interface{} @Failure 400 {object} meta.HTTPRespo

(c *gin.Context)

Source from the content-addressed store, hash-verified

115// @Failure 400 {object} meta.HTTPResponseError
116// @Router /es/{target}/_alias/{target_alias} [get]
117func GetESAliases(c *gin.Context) {
118 targetIndex := c.Param("target")
119
120 var targetIndexes []string
121 if targetIndex != "" {
122 targetIndexes = strings.Split(targetIndex, ",")
123 }
124
125 targetAlias := c.Param("target_alias")
126
127 var targetAliases []string
128 if targetAlias != "" {
129 targetAliases = strings.Split(targetAlias, ",")
130 }
131
132 m := core.ZINC_INDEX_ALIAS_LIST.GetAliasMap(targetIndexes, targetAliases)
133
134 zutils.GinRenderJSON(c, http.StatusOK, m)
135}
136
137func indexNameMatches(name, indexName string) bool {
138 if name == indexName {

Callers 1

TestGetESAliasesFunction · 0.85

Calls 2

GinRenderJSONFunction · 0.92
GetAliasMapMethod · 0.80

Tested by 1

TestGetESAliasesFunction · 0.68