mirror of
https://codeberg.org/scip/esctl.git
synced 2026-08-24 06:34:18 +02:00
marshall explain output only in debug mode
This commit is contained in:
@@ -86,13 +86,12 @@ func explainSearch(conf *cfg.Config, search *search.Search) error {
|
|||||||
return fmt.Errorf("failed to call explain search (esdsl): %s", esErrorString(err))
|
return fmt.Errorf("failed to call explain search (esdsl): %s", esErrorString(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
raw, err := json.Marshal(res)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to marshal explain result: %s", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if conf.Debug {
|
if conf.Debug {
|
||||||
repr.Println(res)
|
raw, err := json.Marshal(res)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to marshal explain result: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
value := gjson.Get(string(raw), "hits.hits.0._explanation")
|
value := gjson.Get(string(raw), "hits.hits.0._explanation")
|
||||||
fmt.Println(value.String())
|
fmt.Println(value.String())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user