From a87f6d0c4f86942436de0e068175483fe9d15235 Mon Sep 17 00:00:00 2001 From: "T. von Dein" Date: Fri, 26 Jun 2026 11:32:53 +0200 Subject: [PATCH] add --hidden flag (default off) to 'index ls' and 'ilm forecast ls' (#55) --- cmd/ilm_forecast.go | 6 ++++++ cmd/index.go | 6 ++++++ pkg/es/ilm_forecast.go | 4 +--- pkg/es/index.go | 5 +++++ 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/cmd/ilm_forecast.go b/cmd/ilm_forecast.go index a944d04..968172d 100644 --- a/cmd/ilm_forecast.go +++ b/cmd/ilm_forecast.go @@ -87,6 +87,12 @@ func IlmForecastList(conf *cfg.Config) *cli.Command { Destination: &conf.Verbose, Aliases: []string{"v"}, }, + &cli.BoolFlag{ + Name: "hidden", + Usage: "include hidden indicies", + Destination: &conf.Hidden, + Aliases: []string{"H"}, + }, }, Action: func(ctx context.Context, cmd *cli.Command) error { diff --git a/cmd/index.go b/cmd/index.go index 38b2977..2488bf4 100644 --- a/cmd/index.go +++ b/cmd/index.go @@ -70,6 +70,12 @@ func IndexList(conf *cfg.Config) *cli.Command { Destination: &conf.Partials, Aliases: []string{"p"}, }, + &cli.BoolFlag{ + Name: "hidden", + Usage: "include hidden indicies", + Destination: &conf.Hidden, + Aliases: []string{"H"}, + }, &cli.BoolFlag{ Name: "reds", Usage: "include only red failed indicies", diff --git a/pkg/es/ilm_forecast.go b/pkg/es/ilm_forecast.go index a284e39..c9db433 100644 --- a/pkg/es/ilm_forecast.go +++ b/pkg/es/ilm_forecast.go @@ -225,9 +225,7 @@ func getIlmPhaseData(conf *cfg.Config) ([]PhaseData, error) { } for indexName, explain := range ilmdetails.Indices { - if strings.HasPrefix(indexName, ".ds-") || - strings.HasPrefix(indexName, ".monitoring-") || - strings.HasPrefix(indexName, ".internal") { + if !conf.Hidden && strings.HasPrefix(indexName, ".") { continue } diff --git a/pkg/es/index.go b/pkg/es/index.go index 023300a..be8a6d4 100644 --- a/pkg/es/index.go +++ b/pkg/es/index.go @@ -53,11 +53,16 @@ func IndexNames(conf *cfg.Config) ([]string, error) { func filterIndices(conf *cfg.Config, list indices.Response) indices.Response { // apply partials filter first selectedlist := indices.Response{} + for _, index := range list { if !conf.Partials && strings.HasPrefix(*index.Index, "partial-") { continue } + if !conf.Hidden && strings.HasPrefix(*index.Index, ".") { + continue + } + if strings.HasPrefix(*index.Index, ".ds-") { // ignore data stream backing indicies continue