add "cluster compare" command and add 1st check (unsync indices) (#2)

This commit is contained in:
T. von Dein
2026-04-27 13:05:30 +02:00
parent 17f92874e5
commit 3cbc67567b
5 changed files with 214 additions and 7 deletions

View File

@@ -26,7 +26,10 @@ import (
)
func IndexList(conf *cfg.Config) error {
cat := conf.DefaultCluster.ES.Cat.Indices()
cat := conf.DefaultCluster.ES.Cat.Indices().
// we need to add custom request headers, required for older ES instances
Header("content-type", "application/json").
Header("accept", "application/json")
if conf.Failed {
cat = cat.Health(healthstatus.Red)
@@ -67,7 +70,11 @@ func IndexList(conf *cfg.Config) error {
}
func IndexShow(conf *cfg.Config, index string) error {
res, err := conf.DefaultCluster.ES.Indices.Get(index).Do(context.Background())
res, err := conf.DefaultCluster.ES.Indices.Get(index).
// we need to add custom request headers, required for older ES instances
Header("content-type", "application/json").
Header("accept", "application/json").
Do(context.Background())
if err != nil {
return fmt.Errorf("failed to get index: %s", err)
}