From a9f28a0805489377ddf1e58adc5588b00ac22595 Mon Sep 17 00:00:00 2001 From: styshoo Date: Thu, 28 Oct 2021 18:39:16 +0800 Subject: [PATCH] enable es v7 TrackTotalHits parameter, make sure kubesphere cosole would get correct total number --- pkg/simple/client/es/versions/v7/v7.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/simple/client/es/versions/v7/v7.go b/pkg/simple/client/es/versions/v7/v7.go index d76565b96..f79700f9a 100644 --- a/pkg/simple/client/es/versions/v7/v7.go +++ b/pkg/simple/client/es/versions/v7/v7.go @@ -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)), }