@@ -864,6 +864,10 @@ public ClusterHealthStatus ensureGreen(TimeValue timeout, String... indices) {
864864 return ensureColor (ClusterHealthStatus .GREEN , timeout , false , indices );
865865 }
866866
867+ public ClusterHealthStatus ensureGreen (TimeValue timeout , boolean waitForNoRelocatingShards , String ... indices ) {
868+ return ensureColor (ClusterHealthStatus .GREEN , timeout , waitForNoRelocatingShards , false , indices );
869+ }
870+
867871 /**
868872 * Ensures the cluster has a yellow state via the cluster health API.
869873 */
@@ -891,6 +895,16 @@ private ClusterHealthStatus ensureColor(
891895 TimeValue timeout ,
892896 boolean waitForNoInitializingShards ,
893897 String ... indices
898+ ) {
899+ return ensureColor (clusterHealthStatus , timeout , true , waitForNoInitializingShards , indices );
900+ }
901+
902+ private ClusterHealthStatus ensureColor (
903+ ClusterHealthStatus clusterHealthStatus ,
904+ TimeValue timeout ,
905+ boolean waitForNoRelocatingShards ,
906+ boolean waitForNoInitializingShards ,
907+ String ... indices
894908 ) {
895909 String color = clusterHealthStatus .name ().toLowerCase (Locale .ROOT );
896910 String method = "ensure" + Strings .capitalize (color );
@@ -899,7 +913,7 @@ private ClusterHealthStatus ensureColor(
899913 .timeout (timeout )
900914 .waitForStatus (clusterHealthStatus )
901915 .waitForEvents (Priority .LANGUID )
902- .waitForNoRelocatingShards (true )
916+ .waitForNoRelocatingShards (waitForNoRelocatingShards )
903917 .waitForNoInitializingShards (waitForNoInitializingShards )
904918 // We currently often use ensureGreen or ensureYellow to check whether the cluster is back in a good state after shutting down
905919 // a node. If the node that is stopped is the cluster-manager node, another node will become cluster-manager and publish a
0 commit comments