enable es v7 TrackTotalHits parameter, make sure kubesphere cosole would get correct total number

This commit is contained in:
styshoo
2021-10-28 18:39:16 +08:00
parent 18527f895e
commit a9f28a0805

View File

@@ -62,6 +62,7 @@ func (e *Elastic) Search(indices string, body []byte, scroll bool) ([]byte, erro
opts := []func(*esapi.SearchRequest){
e.client.Search.WithContext(context.Background()),
e.client.Search.WithIndex(indices),
e.client.Search.WithTrackTotalHits(true),
e.client.Search.WithIgnoreUnavailable(true),
e.client.Search.WithBody(bytes.NewBuffer(body)),
}