/** * Sets whether the request should wait for there to be no initializing shards before * retrieving the cluster health status. Defaults to <code>false</code>, meaning the * operation does not wait on there being no more initializing shards. Set to <code>true</code> * to wait until the number of initializing shards in the cluster is 0. */ public ClusterHealthRequestBuilder setWaitForNoInitializingShards(boolean waitForNoInitializingShards) { request.waitForNoInitializingShards(waitForNoInitializingShards); return this; }
waitForCounter++; if (request.waitForNoInitializingShards() && response.getInitializingShards() == 0) { waitForCounter++;
/** * Sets whether the request should wait for there to be no initializing shards before * retrieving the cluster health status. Defaults to <code>false</code>, meaning the * operation does not wait on there being no more initializing shards. Set to <code>true</code> * to wait until the number of initializing shards in the cluster is 0. */ public ClusterHealthRequestBuilder setWaitForNoInitializingShards(boolean waitForNoInitializingShards) { request.waitForNoInitializingShards(waitForNoInitializingShards); return this; }
/** * Sets whether the request should wait for there to be no initializing shards before * retrieving the cluster health status. Defaults to <code>false</code>, meaning the * operation does not wait on there being no more initializing shards. Set to <code>true</code> * to wait until the number of initializing shards in the cluster is 0. */ public ClusterHealthRequestBuilder setWaitForNoInitializingShards(boolean waitForNoInitializingShards) { request.waitForNoInitializingShards(waitForNoInitializingShards); return this; }
waitFor++; if (request.waitForNoInitializingShards()) { waitFor++;
@Override public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { ClusterHealthRequest clusterHealthRequest = clusterHealthRequest(Strings.splitStringByCommaToArray(request.param("index"))); clusterHealthRequest.local(request.paramAsBoolean("local", clusterHealthRequest.local())); clusterHealthRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterHealthRequest.masterNodeTimeout())); clusterHealthRequest.timeout(request.paramAsTime("timeout", clusterHealthRequest.timeout())); String waitForStatus = request.param("wait_for_status"); if (waitForStatus != null) { clusterHealthRequest.waitForStatus(ClusterHealthStatus.valueOf(waitForStatus.toUpperCase(Locale.ROOT))); } clusterHealthRequest.waitForNoRelocatingShards( request.paramAsBoolean("wait_for_no_relocating_shards", clusterHealthRequest.waitForNoRelocatingShards())); clusterHealthRequest.waitForNoInitializingShards( request.paramAsBoolean("wait_for_no_initializing_shards", clusterHealthRequest.waitForNoRelocatingShards())); if (request.hasParam("wait_for_relocating_shards")) { // wait_for_relocating_shards has been removed in favor of wait_for_no_relocating_shards throw new IllegalArgumentException("wait_for_relocating_shards has been removed, " + "use wait_for_no_relocating_shards [true/false] instead"); } String waitForActiveShards = request.param("wait_for_active_shards"); if (waitForActiveShards != null) { clusterHealthRequest.waitForActiveShards(ActiveShardCount.parseString(waitForActiveShards)); } clusterHealthRequest.waitForNodes(request.param("wait_for_nodes", clusterHealthRequest.waitForNodes())); if (request.param("wait_for_events") != null) { clusterHealthRequest.waitForEvents(Priority.valueOf(request.param("wait_for_events").toUpperCase(Locale.ROOT))); } return channel -> client.admin().cluster().health(clusterHealthRequest, new RestStatusToXContentListener<>(channel)); }
waitForCounter++; if (request.waitForNoInitializingShards() && response.getInitializingShards() == 0) { waitForCounter++;
waitForCounter++; if (request.waitForNoInitializingShards() && response.getInitializingShards() == 0) { waitForCounter++;
.waitForEvents(Priority.LANGUID) .waitForNoRelocatingShards(true) .waitForNoInitializingShards(waitForNoInitializingShards)
waitFor++; if (request.waitForNoInitializingShards()) { waitFor++;
waitFor++; if (request.waitForNoInitializingShards()) { waitFor++;
@Override public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { ClusterHealthRequest clusterHealthRequest = clusterHealthRequest(Strings.splitStringByCommaToArray(request.param("index"))); clusterHealthRequest.local(request.paramAsBoolean("local", clusterHealthRequest.local())); clusterHealthRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterHealthRequest.masterNodeTimeout())); clusterHealthRequest.timeout(request.paramAsTime("timeout", clusterHealthRequest.timeout())); String waitForStatus = request.param("wait_for_status"); if (waitForStatus != null) { clusterHealthRequest.waitForStatus(ClusterHealthStatus.valueOf(waitForStatus.toUpperCase(Locale.ROOT))); } clusterHealthRequest.waitForNoRelocatingShards( request.paramAsBoolean("wait_for_no_relocating_shards", clusterHealthRequest.waitForNoRelocatingShards())); clusterHealthRequest.waitForNoInitializingShards( request.paramAsBoolean("wait_for_no_initializing_shards", clusterHealthRequest.waitForNoRelocatingShards())); if (request.hasParam("wait_for_relocating_shards")) { // wait_for_relocating_shards has been removed in favor of wait_for_no_relocating_shards throw new IllegalArgumentException("wait_for_relocating_shards has been removed, " + "use wait_for_no_relocating_shards [true/false] instead"); } String waitForActiveShards = request.param("wait_for_active_shards"); if (waitForActiveShards != null) { clusterHealthRequest.waitForActiveShards(ActiveShardCount.parseString(waitForActiveShards)); } clusterHealthRequest.waitForNodes(request.param("wait_for_nodes", clusterHealthRequest.waitForNodes())); if (request.param("wait_for_events") != null) { clusterHealthRequest.waitForEvents(Priority.valueOf(request.param("wait_for_events").toUpperCase(Locale.ROOT))); } return channel -> client.admin().cluster().health(clusterHealthRequest, new RestStatusToXContentListener<>(channel)); }
@Override public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { ClusterHealthRequest clusterHealthRequest = clusterHealthRequest(Strings.splitStringByCommaToArray(request.param("index"))); clusterHealthRequest.local(request.paramAsBoolean("local", clusterHealthRequest.local())); clusterHealthRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterHealthRequest.masterNodeTimeout())); clusterHealthRequest.timeout(request.paramAsTime("timeout", clusterHealthRequest.timeout())); String waitForStatus = request.param("wait_for_status"); if (waitForStatus != null) { clusterHealthRequest.waitForStatus(ClusterHealthStatus.valueOf(waitForStatus.toUpperCase(Locale.ROOT))); } clusterHealthRequest.waitForNoRelocatingShards( request.paramAsBoolean("wait_for_no_relocating_shards", clusterHealthRequest.waitForNoRelocatingShards())); clusterHealthRequest.waitForNoInitializingShards( request.paramAsBoolean("wait_for_no_initializing_shards", clusterHealthRequest.waitForNoRelocatingShards())); if (request.hasParam("wait_for_relocating_shards")) { // wait_for_relocating_shards has been removed in favor of wait_for_no_relocating_shards throw new IllegalArgumentException("wait_for_relocating_shards has been removed, " + "use wait_for_no_relocating_shards [true/false] instead"); } String waitForActiveShards = request.param("wait_for_active_shards"); if (waitForActiveShards != null) { clusterHealthRequest.waitForActiveShards(ActiveShardCount.parseString(waitForActiveShards)); } clusterHealthRequest.waitForNodes(request.param("wait_for_nodes", clusterHealthRequest.waitForNodes())); if (request.param("wait_for_events") != null) { clusterHealthRequest.waitForEvents(Priority.valueOf(request.param("wait_for_events").toUpperCase(Locale.ROOT))); } return channel -> client.admin().cluster().health(clusterHealthRequest, new RestStatusToXContentListener<>(channel)); }
static Request clusterHealth(ClusterHealthRequest healthRequest) { String[] indices = healthRequest.indices() == null ? Strings.EMPTY_ARRAY : healthRequest.indices(); String endpoint = new RequestConverters.EndpointBuilder() .addPathPartAsIs("_cluster/health") .addCommaSeparatedPathParts(indices) .build(); Request request = new Request(HttpGet.METHOD_NAME, endpoint); new RequestConverters.Params(request) .withWaitForStatus(healthRequest.waitForStatus()) .withWaitForNoRelocatingShards(healthRequest.waitForNoRelocatingShards()) .withWaitForNoInitializingShards(healthRequest.waitForNoInitializingShards()) .withWaitForActiveShards(healthRequest.waitForActiveShards(), ActiveShardCount.NONE) .withWaitForNodes(healthRequest.waitForNodes()) .withWaitForEvents(healthRequest.waitForEvents()) .withTimeout(healthRequest.timeout()) .withMasterTimeout(healthRequest.masterNodeTimeout()) .withLocal(healthRequest.local()) .withLevel(healthRequest.level()); return request; } }
static Request clusterHealth(ClusterHealthRequest healthRequest) { String[] indices = healthRequest.indices() == null ? Strings.EMPTY_ARRAY : healthRequest.indices(); String endpoint = new RequestConverters.EndpointBuilder() .addPathPartAsIs("_cluster/health") .addCommaSeparatedPathParts(indices) .build(); Request request = new Request(HttpGet.METHOD_NAME, endpoint); new RequestConverters.Params(request) .withWaitForStatus(healthRequest.waitForStatus()) .withWaitForNoRelocatingShards(healthRequest.waitForNoRelocatingShards()) .withWaitForNoInitializingShards(healthRequest.waitForNoInitializingShards()) .withWaitForActiveShards(healthRequest.waitForActiveShards(), ActiveShardCount.NONE) .withWaitForNodes(healthRequest.waitForNodes()) .withWaitForEvents(healthRequest.waitForEvents()) .withTimeout(healthRequest.timeout()) .withMasterTimeout(healthRequest.masterNodeTimeout()) .withLocal(healthRequest.local()) .withLevel(healthRequest.level()); return request; } }