Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wait_for_no_initializing_shards to cluster health API #1616

Open
wants to merge 1 commit into
base: release-branch.v7
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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