diff --git a/CONTRIBUTORS b/CONTRIBUTORS index e75263a62..ba06dac29 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -68,6 +68,7 @@ Joe Buck [@four2five](https://github.com/four2five) John Barker [@j16r](https://github.com/j16r) John Goodall [@jgoodall](https://github.com/jgoodall) John Stanford [@jxstanford](https://github.com/jxstanford) +Jonas Groenaas Drange [@semafor](https://github.com/semafor) Josh Chorlton [@jchorl](https://github.com/jchorl) jun [@coseyo](https://github.com/coseyo) Junpei Tsuji [@jun06t](https://github.com/jun06t) diff --git a/client.go b/client.go index 6ee9b45bb..165a30526 100644 --- a/client.go +++ b/client.go @@ -26,7 +26,7 @@ import ( const ( // Version is the current version of Elastic. - Version = "6.1.6" + Version = "6.1.7" // DefaultURL is the default endpoint of Elasticsearch on the local machine. // It is used e.g. when initializing a new Client without a specific URL. diff --git a/errors.go b/errors.go index d16135a6f..e40cda845 100644 --- a/errors.go +++ b/errors.go @@ -94,7 +94,7 @@ func (e *Error) Error() string { // IsConnErr returns true if the error indicates that Elastic could not // find an Elasticsearch host to connect to. func IsConnErr(err error) bool { - return errors.Cause(err) == ErrNoClient + return err == ErrNoClient || errors.Cause(err) == ErrNoClient } // IsNotFound returns true if the given error indicates that Elasticsearch diff --git a/reindex.go b/reindex.go index 35440fa80..9cdd50a68 100644 --- a/reindex.go +++ b/reindex.go @@ -20,6 +20,7 @@ type ReindexService struct { waitForActiveShards string waitForCompletion *bool requestsPerSecond *int + slices *int body interface{} source *ReindexSource destination *ReindexDestination @@ -51,6 +52,12 @@ func (s *ReindexService) RequestsPerSecond(requestsPerSecond int) *ReindexServic return s } +// Slices specifies the number of slices this task should be divided into. Defaults to 1. +func (s *ReindexService) Slices(slices int) *ReindexService { + s.slices = &slices + return s +} + // Refresh indicates whether Elasticsearch should refresh the effected indexes // immediately. func (s *ReindexService) Refresh(refresh string) *ReindexService { @@ -179,6 +186,9 @@ func (s *ReindexService) buildURL() (string, url.Values, error) { if s.requestsPerSecond != nil { params.Set("requests_per_second", fmt.Sprintf("%v", *s.requestsPerSecond)) } + if s.slices != nil { + params.Set("slices", fmt.Sprintf("%v", *s.slices)) + } if s.waitForActiveShards != "" { params.Set("wait_for_active_shards", s.waitForActiveShards) }