code: public ClusterHealthStatus ensureGreen(final String... indices) {
          final ClusterHealthResponse actionGet = client().admin().cluster().health(
                  Requests.clusterHealthRequest(indices).waitForGreenStatus().waitForEvents(Priority.LANGUID).waitForNoRelocatingShards(true))
                  .actionGet();
          if (actionGet.isTimedOut()) {
              onFailure("ensureGreen timed out, cluster state:\n" + client().admin().cluster().prepareState().get().getState() + "\n"
                      + client().admin().cluster().preparePendingClusterTasks().get(), actionGet);
          }
          return actionGet.getStatus();
      }
docs: Wait for green state of a cluster.
  
  @param indices indices to check status
  @return cluster health status