Skip to content

Commit

Permalink
Fix olivere#706 by introducing the option
Browse files Browse the repository at this point in the history
  • Loading branch information
jgdxtv2 committed Feb 13, 2018
1 parent c26049b commit e07e4f3
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions reindex.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type ReindexService struct {
conflicts string
size *int
script *Script
slices *int
}

// NewReindexService creates a new ReindexService.
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit e07e4f3

Please sign in to comment.