mirror of
https://codeberg.org/scip/esctl.git
synced 2026-08-24 10:04:18 +02:00
enhanced default cluster selection, add 'cluster switch', overhaul json header setting (#47)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user