Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions cluster_health.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type ClusterHealthService struct {
timeout string
waitForActiveShards *int
waitForNodes string
waitForNoInitializingShards *bool
waitForNoRelocatingShards *bool
waitForStatus string
}
Expand Down Expand Up @@ -130,6 +131,12 @@ func (s *ClusterHealthService) WaitForNodes(waitForNodes string) *ClusterHealthS
return s
}

// WaitForNoRelocatingShards can be used to wait until all shard relocations are finished.
func (s *ClusterHealthService) WaitForNoInitializingShards(waitForNoInitializingShards bool) *ClusterHealthService {
s.waitForNoInitializingShards = &waitForNoInitializingShards
return s
}

// WaitForNoRelocatingShards can be used to wait until all shard relocations are finished.
func (s *ClusterHealthService) WaitForNoRelocatingShards(waitForNoRelocatingShards bool) *ClusterHealthService {
s.waitForNoRelocatingShards = &waitForNoRelocatingShards
Expand Down Expand Up @@ -201,6 +208,9 @@ func (s *ClusterHealthService) buildURL() (string, url.Values, error) {
if s.waitForNodes != "" {
params.Set("wait_for_nodes", s.waitForNodes)
}
if s.waitForNoInitializingShards != nil {
params.Set("wait_for_no_initializing_shards", fmt.Sprintf("%v", *s.waitForNoInitializingShards))
}
if s.waitForNoRelocatingShards != nil {
params.Set("wait_for_no_relocating_shards", fmt.Sprintf("%v", *s.waitForNoRelocatingShards))
}
Expand Down