aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/olivere/elastic/v7/scroll.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/olivere/elastic/v7/scroll.go')
-rw-r--r--vendor/github.com/olivere/elastic/v7/scroll.go40
1 files changed, 27 insertions, 13 deletions
diff --git a/vendor/github.com/olivere/elastic/v7/scroll.go b/vendor/github.com/olivere/elastic/v7/scroll.go
index 626731ec0e..92c859e3f9 100644
--- a/vendor/github.com/olivere/elastic/v7/scroll.go
+++ b/vendor/github.com/olivere/elastic/v7/scroll.go
@@ -32,19 +32,20 @@ type ScrollService struct {
filterPath []string // list of filters used to reduce the response
headers http.Header // custom request-level HTTP headers
- indices []string
- types []string
- keepAlive string
- body interface{}
- ss *SearchSource
- size *int
- routing string
- preference string
- ignoreUnavailable *bool
- ignoreThrottled *bool
- allowNoIndices *bool
- expandWildcards string
- maxResponseSize int64
+ indices []string
+ types []string
+ keepAlive string
+ body interface{}
+ ss *SearchSource
+ size *int
+ routing string
+ preference string
+ ignoreUnavailable *bool
+ ignoreThrottled *bool
+ allowNoIndices *bool
+ expandWildcards string
+ maxResponseSize int64
+ restTotalHitsAsInt *bool
mu sync.RWMutex
scrollId string
@@ -249,6 +250,13 @@ func (s *ScrollService) TrackTotalHits(trackTotalHits interface{}) *ScrollServic
return s
}
+// RestTotalHitsAsInt indicates whether hits.total should be rendered as an
+// integer or an object in the rest search response.
+func (s *ScrollService) RestTotalHitsAsInt(enabled bool) *ScrollService {
+ s.restTotalHitsAsInt = &enabled
+ return s
+}
+
// Routing is a list of specific routing values to control the shards
// the search will be executed on.
func (s *ScrollService) Routing(routings ...string) *ScrollService {
@@ -507,6 +515,9 @@ func (s *ScrollService) buildFirstURL() (string, url.Values, error) {
if s.ignoreThrottled != nil {
params.Set("ignore_throttled", fmt.Sprintf("%v", *s.ignoreThrottled))
}
+ if v := s.restTotalHitsAsInt; v != nil {
+ params.Set("rest_total_hits_as_int", fmt.Sprint(*v))
+ }
return path, params, nil
}
@@ -607,6 +618,9 @@ func (s *ScrollService) buildNextURL() (string, url.Values, error) {
}
params.Set("filter_path", strings.Join(s.filterPath, ","))
}
+ if v := s.restTotalHitsAsInt; v != nil {
+ params.Set("rest_total_hits_as_int", fmt.Sprint(*v))
+ }
return path, params, nil
}