From 82c6d2e7bbde672c69f1118a782bf6343ce2ee93 Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Wed, 8 Jul 2026 09:57:39 +0200 Subject: [PATCH] show green and failed indices in status, rename red to failed in index ls --- cmd/index.go | 4 ++-- pkg/es/cluster.go | 14 ++++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/cmd/index.go b/cmd/index.go index 943ec0b..03bb624 100644 --- a/cmd/index.go +++ b/cmd/index.go @@ -75,10 +75,10 @@ func IndexList(conf *cfg.Config) *cli.Command { Aliases: []string{"H"}, }, &cli.BoolFlag{ - Name: "reds", + Name: "failed", Usage: "include only red failed indicies", Destination: &conf.Failed, - Aliases: []string{"r"}, + Aliases: []string{"f"}, }, &cli.StringSliceFlag{ Name: "filter", diff --git a/pkg/es/cluster.go b/pkg/es/cluster.go index 8222859..c0960e7 100644 --- a/pkg/es/cluster.go +++ b/pkg/es/cluster.go @@ -174,11 +174,16 @@ func ClusterStatus(conf *cfg.Config) error { } // look for red indices, if any - redindices := 0 + failedIndices := 0 + greenIndices := 0 for _, index := range *res.indices { - if *index.Health == "red" { - redindices++ + switch { + case *index.Health != "green": + failedIndices++ + case !strings.HasPrefix(*index.Index, "."): + // don't count internal indices + greenIndices++ } } @@ -205,7 +210,8 @@ func ClusterStatus(conf *cfg.Config) error { {"Unassigned Primary Shards", res.health.UnassignedPrimaryShards}, {"Pending Tasks", res.health.NumberOfPendingTasks}, {"Nodes", res.health.NumberOfNodes}, - {"Red Indices", redindices}, + {"Green Indices", greenIndices}, + {"Failed Indices", failedIndices}, {"Long Running Tasks", longtasks}, }