add es version to status output

This commit is contained in:
2026-05-06 13:10:02 +02:00
parent 8109481e23
commit 0122009774
2 changed files with 11 additions and 2 deletions

View File

@@ -124,16 +124,25 @@ func ClusterStatus(conf *cfg.Config) error {
Header("accept", "application/json").
Do(context.Background())
if err != nil {
return fmt.Errorf("failed to getcluster health: %s", err)
return fmt.Errorf("failed to get cluster health: %s", err)
}
slog.Debug("ES result", "cluster health", res)
info, err := es.Info().
Header("content-type", "application/json").
Header("accept", "application/json").
Do(context.Background())
if err != nil {
return fmt.Errorf("failed to get cluster info: %s", err)
}
table := NewTable(2, 5)
table.Addheaders(cluster, "status")
table.entries = [][]string{
{"Cluster Name", Colorize(*&res.Status.Name, res.ClusterName)},
{"ES Version", fmt.Sprintf("%s", info.Version.Int)},
{"Active Shards", fmt.Sprintf("%d", res.ActiveShards)},
{"Active Primary Shards", fmt.Sprintf("%d", res.ActivePrimaryShards)},
{"Indicies", fmt.Sprintf("%d", len(res.Indices))},