summaryrefslogtreecommitdiffstats
path: root/vendor/gopkg.in/olivere/elastic.v5/scroll.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/gopkg.in/olivere/elastic.v5/scroll.go')
-rw-r--r--vendor/gopkg.in/olivere/elastic.v5/scroll.go44
1 files changed, 35 insertions, 9 deletions
diff --git a/vendor/gopkg.in/olivere/elastic.v5/scroll.go b/vendor/gopkg.in/olivere/elastic.v5/scroll.go
index a075ea61f..ac51a8c00 100644
--- a/vendor/gopkg.in/olivere/elastic.v5/scroll.go
+++ b/vendor/gopkg.in/olivere/elastic.v5/scroll.go
@@ -12,7 +12,7 @@ import (
"strings"
"sync"
- "gopkg.in/olivere/elastic.v5/uritemplates"
+ "github.com/olivere/elastic/uritemplates"
)
const (
@@ -23,6 +23,7 @@ const (
// ScrollService iterates over pages of search results from Elasticsearch.
type ScrollService struct {
client *Client
+ retrier Retrier
indices []string
types []string
keepAlive string
@@ -50,6 +51,13 @@ func NewScrollService(client *Client) *ScrollService {
return builder
}
+// Retrier allows to set specific retry logic for this ScrollService.
+// If not specified, it will use the client's default retrier.
+func (s *ScrollService) Retrier(retrier Retrier) *ScrollService {
+ s.retrier = retrier
+ return s
+}
+
// Index sets the name of one or more indices to iterate over.
func (s *ScrollService) Index(indices ...string) *ScrollService {
if s.indices == nil {
@@ -117,7 +125,7 @@ func (s *ScrollService) Query(query Query) *ScrollService {
// PostFilter is executed as the last filter. It only affects the
// search hits but not facets. See
-// https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-request-post-filter.html
+// https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-request-post-filter.html
// for details.
func (s *ScrollService) PostFilter(postFilter Query) *ScrollService {
s.ss = s.ss.PostFilter(postFilter)
@@ -126,7 +134,7 @@ func (s *ScrollService) PostFilter(postFilter Query) *ScrollService {
// Slice allows slicing the scroll request into several batches.
// This is supported in Elasticsearch 5.0 or later.
-// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-request-scroll.html#sliced-scroll
+// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-request-scroll.html#sliced-scroll
// for details.
func (s *ScrollService) Slice(sliceQuery Query) *ScrollService {
s.ss = s.ss.Slice(sliceQuery)
@@ -147,7 +155,7 @@ func (s *ScrollService) FetchSourceContext(fetchSourceContext *FetchSourceContex
}
// Version can be set to true to return a version for each search hit.
-// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-request-version.html.
+// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-request-version.html.
func (s *ScrollService) Version(version bool) *ScrollService {
s.ss = s.ss.Version(version)
return s
@@ -258,7 +266,13 @@ func (s *ScrollService) Clear(ctx context.Context) error {
ScrollId: []string{scrollId},
}
- _, err := s.client.PerformRequest(ctx, "DELETE", path, params, body)
+ _, err := s.client.PerformRequest(ctx, PerformRequestOptions{
+ Method: "DELETE",
+ Path: path,
+ Params: params,
+ Body: body,
+ Retrier: s.retrier,
+ })
if err != nil {
return err
}
@@ -283,7 +297,13 @@ func (s *ScrollService) first(ctx context.Context) (*SearchResult, error) {
}
// Get HTTP response
- res, err := s.client.PerformRequest(ctx, "POST", path, params, body)
+ res, err := s.client.PerformRequest(ctx, PerformRequestOptions{
+ Method: "POST",
+ Path: path,
+ Params: params,
+ Body: body,
+ Retrier: s.retrier,
+ })
if err != nil {
return nil, err
}
@@ -330,7 +350,7 @@ func (s *ScrollService) buildFirstURL() (string, url.Values, error) {
// Add query string parameters
params := url.Values{}
if s.pretty {
- params.Set("pretty", "1")
+ params.Set("pretty", "true")
}
if s.size != nil && *s.size > 0 {
params.Set("size", fmt.Sprintf("%d", *s.size))
@@ -397,7 +417,13 @@ func (s *ScrollService) next(ctx context.Context) (*SearchResult, error) {
}
// Get HTTP response
- res, err := s.client.PerformRequest(ctx, "POST", path, params, body)
+ res, err := s.client.PerformRequest(ctx, PerformRequestOptions{
+ Method: "POST",
+ Path: path,
+ Params: params,
+ Body: body,
+ Retrier: s.retrier,
+ })
if err != nil {
return nil, err
}
@@ -423,7 +449,7 @@ func (s *ScrollService) buildNextURL() (string, url.Values, error) {
// Add query string parameters
params := url.Values{}
if s.pretty {
- params.Set("pretty", "1")
+ params.Set("pretty", "true")
}
return path, params, nil