get rid of getJsonPath, use flat_settings query flag instead (#66)

This commit is contained in:
T. von Dein
2026-07-03 10:25:57 +02:00
parent 1fc2004474
commit c9fb572935
4 changed files with 5 additions and 63 deletions

View File

@@ -28,7 +28,7 @@ type Tpl struct {
}
func getIndexTemplateSettings(conf *cfg.Config, tplname string, table *printer.Table) error {
raw, err := CallAPI(conf, "GET", "/_index_template/"+tplname, "")
raw, err := CallAPI(conf, "GET", "/_index_template/"+tplname+"?flat_settings", "")
if err != nil {
return err
}
@@ -52,11 +52,7 @@ func getIndexTemplateSettings(conf *cfg.Config, tplname string, table *printer.T
tpl := data.IndexTemplates[0].IndexTemplate.Template.Settings
for topic, val := range tpl {
paths := getJsonPath(map[string]string{}, val.(map[string]any), topic)
for setting, value := range paths {
table.Entries = append(table.Entries, []string{setting, fmt.Sprintf("%v", value)})
}
table.Entries = append(table.Entries, []string{topic, fmt.Sprintf("%v", val)})
}
return nil