@@ -863,6 +863,10 @@ public ClusterHealthStatus ensureGreen(TimeValue timeout, String... indices) {
863
863
return ensureColor (ClusterHealthStatus .GREEN , timeout , false , indices );
864
864
}
865
865
866
+ public ClusterHealthStatus ensureGreen (TimeValue timeout , boolean waitForNoRelocatingShards , String ... indices ) {
867
+ return ensureColor (ClusterHealthStatus .GREEN , timeout , waitForNoRelocatingShards , false , indices );
868
+ }
869
+
866
870
/**
867
871
* Ensures the cluster has a yellow state via the cluster health API.
868
872
*/
@@ -890,6 +894,16 @@ private ClusterHealthStatus ensureColor(
890
894
TimeValue timeout ,
891
895
boolean waitForNoInitializingShards ,
892
896
String ... indices
897
+ ) {
898
+ return ensureColor (clusterHealthStatus , timeout , true , waitForNoInitializingShards , indices );
899
+ }
900
+
901
+ private ClusterHealthStatus ensureColor (
902
+ ClusterHealthStatus clusterHealthStatus ,
903
+ TimeValue timeout ,
904
+ boolean waitForNoRelocatingShards ,
905
+ boolean waitForNoInitializingShards ,
906
+ String ... indices
893
907
) {
894
908
String color = clusterHealthStatus .name ().toLowerCase (Locale .ROOT );
895
909
String method = "ensure" + Strings .capitalize (color );
@@ -898,7 +912,7 @@ private ClusterHealthStatus ensureColor(
898
912
.timeout (timeout )
899
913
.waitForStatus (clusterHealthStatus )
900
914
.waitForEvents (Priority .LANGUID )
901
- .waitForNoRelocatingShards (true )
915
+ .waitForNoRelocatingShards (waitForNoRelocatingShards )
902
916
.waitForNoInitializingShards (waitForNoInitializingShards )
903
917
// We currently often use ensureGreen or ensureYellow to check whether the cluster is back in a good state after shutting down
904
918
// 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