mirror of
https://codeberg.org/scip/esctl.git
synced 2026-08-24 06:34:18 +02:00
add index alias delete (#20)
This commit is contained in:
@@ -35,8 +35,8 @@ func IndexAlias(conf *cfg.Config) *cli.Command {
|
||||
Commands: []*cli.Command{
|
||||
IndexAliasCreate(conf),
|
||||
IndexAliasList(conf),
|
||||
IndexAliasDelete(conf),
|
||||
//IndexAliasShow(conf),
|
||||
//IndexAliasDelete(conf),
|
||||
//IndexAliasAdd(conf), // see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-update-aliases
|
||||
},
|
||||
}
|
||||
@@ -62,6 +62,26 @@ func IndexAliasCreate(conf *cfg.Config) *cli.Command {
|
||||
}
|
||||
}
|
||||
|
||||
func IndexAliasDelete(conf *cfg.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "delete",
|
||||
Aliases: []string{"rm"},
|
||||
Usage: "delete an index alias",
|
||||
UsageText: "delete <index> <alias>",
|
||||
|
||||
Action: func(ctx context.Context, cmd *cli.Command) error {
|
||||
index := cmd.Args().Get(0)
|
||||
alias := cmd.Args().Get(1)
|
||||
|
||||
if index == "" || alias == "" {
|
||||
return errors.New("no index or alias specified")
|
||||
}
|
||||
|
||||
return es.IndexAliasDelete(conf, index, alias)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func IndexAliasList(conf *cfg.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "list",
|
||||
|
||||
Reference in New Issue
Block a user