add explain index allocation

This commit is contained in:
T. von Dein
2026-05-18 13:58:08 +02:00
parent db50072a7b
commit 40e0612bef
6 changed files with 83 additions and 5 deletions

View File

@@ -38,6 +38,7 @@ func Index(conf *cfg.Config) *cli.Command {
IndexCreate(conf),
IndexDelete(conf),
IndexClose(conf),
IndexAllocation(conf),
},
}
}
@@ -75,6 +76,33 @@ func IndexList(conf *cfg.Config) *cli.Command {
}
}
func IndexAllocation(conf *cfg.Config) *cli.Command {
return &cli.Command{
Name: "allocation",
Aliases: []string{"a"},
Usage: "explain index allocation",
Flags: []cli.Flag{
&cli.IntFlag{
Name: "shard",
Usage: "shard number to explain for",
Destination: &conf.Shards,
Aliases: []string{"s"},
},
&cli.BoolFlag{
Name: "primary",
Usage: "explain primary allocation (default true)",
Destination: &conf.Primary,
Aliases: []string{"p"},
},
},
Action: func(ctx context.Context, cmd *cli.Command) error {
return es.IndexAllocation(conf, cmd.Args().Get(0))
},
}
}
func IndexShow(conf *cfg.Config) *cli.Command {
return &cli.Command{
Name: "show",