diff --git a/reindex.go b/reindex.go index 35440fa80..6d80eac17 100644 --- a/reindex.go +++ b/reindex.go @@ -26,6 +26,7 @@ type ReindexService struct { conflicts string size *int script *Script + slices *int } // NewReindexService creates a new ReindexService. @@ -153,6 +154,13 @@ func (s *ReindexService) Script(script *Script) *ReindexService { return s } +// Slices automates slicing of scroll queries returned by the reindex operation, +// which can then be consumed in parallel. +func (s *ReindexService) Slices(slices int) *ReindexService { + s.slices = &slices + return s +} + // Body specifies the body of the request to send to Elasticsearch. // It overrides settings specified with other setters, e.g. Query. func (s *ReindexService) Body(body interface{}) *ReindexService { @@ -185,6 +193,9 @@ func (s *ReindexService) buildURL() (string, url.Values, error) { if s.waitForCompletion != nil { params.Set("wait_for_completion", fmt.Sprintf("%v", *s.waitForCompletion)) } + if s.slices != nil { + params.Set("slices", fmt.Sprintf("%v", *s.slices)) + } return path, params, nil }