add 'index du <index>'

This commit is contained in:
2026-07-08 14:58:07 +02:00
parent 99bf703997
commit 51480e6b35
2 changed files with 101 additions and 0 deletions

View File

@@ -41,6 +41,7 @@ func Index(conf *cfg.Config) *cli.Command {
IndexClose(conf),
IndexFields(conf),
IndexIlm(conf),
IndexDu(conf),
// sub commands
IndexAlias(conf),
@@ -277,3 +278,24 @@ func IndexIlm(conf *cfg.Config) *cli.Command {
},
}
}
func IndexDu(conf *cfg.Config) *cli.Command {
return &cli.Command{
Name: "du",
Usage: "show index disk usage",
UsageText: "index du <index>",
ShellComplete: func(ctx context.Context, cmd *cli.Command) {
complete(conf, cmd, Cindex)
},
Action: func(ctx context.Context, cmd *cli.Command) error {
index := cmd.Args().Get(0)
if index == "" {
return errors.New("no index specified")
}
return es.IndexDiskusage(conf, index)
},
}
}