enhanced default cluster selection, add 'cluster switch', overhaul json header setting (#47)

This commit is contained in:
T. von Dein
2026-06-24 09:25:50 +02:00
parent 3c6819151f
commit ffcb8adb70
26 changed files with 393 additions and 320 deletions

View File

@@ -29,9 +29,7 @@ import (
// FIXME: add filter support, see IndexCreate mapping
func IndexAliasCreate(conf *cfg.Config, index, alias string) error {
res, err := conf.DefaultCluster.ES.Indices.PutAlias(index, alias).
Header("content-type", "application/json").
Header("accept", "application/json").
res, err := conf.DefaultCluster.ES().Indices.PutAlias(index, alias).
Do(context.Background())
slog.Debug("create alias", "result", res)
@@ -51,10 +49,8 @@ func IndexAliasList(conf *cfg.Config) error {
filter = *regexp.MustCompile(conf.Filter[0])
}
res, err := conf.DefaultCluster.ES.Indices.GetAlias().
res, err := conf.DefaultCluster.ES().Indices.GetAlias().
Index("_all").
Header("content-type", "application/json").
Header("accept", "application/json").
Do(context.Background())
if err != nil {
@@ -100,9 +96,7 @@ func IndexAliasList(conf *cfg.Config) error {
}
func IndexAliasDelete(conf *cfg.Config, index, alias string) error {
res, err := conf.DefaultCluster.ES.Indices.DeleteAlias(index, alias).
Header("content-type", "application/json").
Header("accept", "application/json").
res, err := conf.DefaultCluster.ES().Indices.DeleteAlias(index, alias).
Do(context.Background())
slog.Debug("delete alias", "result", res)