From e6de6d40180f2d66e43f2e1ce72451253da9b089 Mon Sep 17 00:00:00 2001 From: Abbas Hussain Date: Thu, 11 Feb 2021 09:10:08 -0800 Subject: [PATCH 1/5] Remove freeze/unfreeze API test --- .../elasticsearch/client/IndicesClientIT.java | 18 -- .../IndicesClientDocumentationIT.java | 160 ------------------ 2 files changed, 178 deletions(-) diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesClientIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesClientIT.java index 4481ebb352637..1ba90f39a8885 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesClientIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesClientIT.java @@ -70,7 +70,6 @@ import org.elasticsearch.client.indices.DeleteAliasRequest; import org.elasticsearch.client.indices.DeleteComposableIndexTemplateRequest; import org.elasticsearch.client.indices.DeleteDataStreamRequest; -import org.elasticsearch.client.indices.FreezeIndexRequest; import org.elasticsearch.client.indices.GetComposableIndexTemplateRequest; import org.elasticsearch.client.indices.GetComposableIndexTemplatesResponse; import org.elasticsearch.client.indices.GetDataStreamRequest; @@ -90,7 +89,6 @@ import org.elasticsearch.client.indices.PutMappingRequest; import org.elasticsearch.client.indices.SimulateIndexTemplateRequest; import org.elasticsearch.client.indices.SimulateIndexTemplateResponse; -import org.elasticsearch.client.indices.UnfreezeIndexRequest; import org.elasticsearch.client.indices.rollover.RolloverRequest; import org.elasticsearch.client.indices.rollover.RolloverResponse; import org.elasticsearch.cluster.metadata.AliasMetadata; @@ -1979,22 +1977,6 @@ public void testAnalyze() throws Exception { assertNotNull(detailsResponse.detail()); } - @AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/57") - public void testFreezeAndUnfreeze() throws IOException { - createIndex("test", Settings.EMPTY); - RestHighLevelClient client = highLevelClient(); - - ShardsAcknowledgedResponse freeze = execute(new FreezeIndexRequest("test"), client.indices()::freeze, - client.indices()::freezeAsync); - assertTrue(freeze.isShardsAcknowledged()); - assertTrue(freeze.isAcknowledged()); - - ShardsAcknowledgedResponse unfreeze = execute(new UnfreezeIndexRequest("test"), client.indices()::unfreeze, - client.indices()::unfreezeAsync); - assertTrue(unfreeze.isShardsAcknowledged()); - assertTrue(unfreeze.isAcknowledged()); - } - public void testDeleteAlias() throws IOException { String index = "test"; createIndex(index, Settings.EMPTY); diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/IndicesClientDocumentationIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/IndicesClientDocumentationIT.java index 27468925798b6..87b7dfd0d1e43 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/IndicesClientDocumentationIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/IndicesClientDocumentationIT.java @@ -67,7 +67,6 @@ import org.elasticsearch.client.indices.DeleteAliasRequest; import org.elasticsearch.client.indices.DeleteComposableIndexTemplateRequest; import org.elasticsearch.client.indices.DetailAnalyzeResponse; -import org.elasticsearch.client.indices.FreezeIndexRequest; import org.elasticsearch.client.indices.GetFieldMappingsRequest; import org.elasticsearch.client.indices.GetFieldMappingsResponse; import org.elasticsearch.client.indices.GetIndexRequest; @@ -86,7 +85,6 @@ import org.elasticsearch.client.indices.PutMappingRequest; import org.elasticsearch.client.indices.SimulateIndexTemplateRequest; import org.elasticsearch.client.indices.SimulateIndexTemplateResponse; -import org.elasticsearch.client.indices.UnfreezeIndexRequest; import org.elasticsearch.client.indices.rollover.RolloverRequest; import org.elasticsearch.client.indices.rollover.RolloverResponse; import org.elasticsearch.cluster.metadata.AliasMetadata; @@ -2952,164 +2950,6 @@ public void onFailure(Exception e) { } - @AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/57") - public void testFreezeIndex() throws Exception { - RestHighLevelClient client = highLevelClient(); - - { - CreateIndexResponse createIndexResponse = client.indices().create(new CreateIndexRequest("index"), RequestOptions.DEFAULT); - assertTrue(createIndexResponse.isAcknowledged()); - } - - { - // tag::freeze-index-request - FreezeIndexRequest request = new FreezeIndexRequest("index"); // <1> - // end::freeze-index-request - - // tag::freeze-index-request-timeout - request.setTimeout(TimeValue.timeValueMinutes(2)); // <1> - // end::freeze-index-request-timeout - // tag::freeze-index-request-masterTimeout - request.setMasterTimeout(TimeValue.timeValueMinutes(1)); // <1> - // end::freeze-index-request-masterTimeout - // tag::freeze-index-request-waitForActiveShards - request.setWaitForActiveShards(ActiveShardCount.DEFAULT); // <1> - // end::freeze-index-request-waitForActiveShards - - // tag::freeze-index-request-indicesOptions - request.setIndicesOptions(IndicesOptions.strictExpandOpen()); // <1> - // end::freeze-index-request-indicesOptions - - // tag::freeze-index-execute - ShardsAcknowledgedResponse openIndexResponse = client.indices().freeze(request, RequestOptions.DEFAULT); - // end::freeze-index-execute - - // tag::freeze-index-response - boolean acknowledged = openIndexResponse.isAcknowledged(); // <1> - boolean shardsAcked = openIndexResponse.isShardsAcknowledged(); // <2> - // end::freeze-index-response - assertTrue(acknowledged); - assertTrue(shardsAcked); - - // tag::freeze-index-execute-listener - ActionListener listener = - new ActionListener() { - @Override - public void onResponse(ShardsAcknowledgedResponse freezeIndexResponse) { - // <1> - } - - @Override - public void onFailure(Exception e) { - // <2> - } - }; - // end::freeze-index-execute-listener - - // Replace the empty listener by a blocking listener in test - final CountDownLatch latch = new CountDownLatch(1); - listener = new LatchedActionListener<>(listener, latch); - - // tag::freeze-index-execute-async - client.indices().freezeAsync(request, RequestOptions.DEFAULT, listener); // <1> - // end::freeze-index-execute-async - - assertTrue(latch.await(30L, TimeUnit.SECONDS)); - } - - { - // tag::freeze-index-notfound - try { - FreezeIndexRequest request = new FreezeIndexRequest("does_not_exist"); - client.indices().freeze(request, RequestOptions.DEFAULT); - } catch (ElasticsearchException exception) { - if (exception.status() == RestStatus.BAD_REQUEST) { - // <1> - } - } - // end::freeze-index-notfound - } - } - - @AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/57") - public void testUnfreezeIndex() throws Exception { - RestHighLevelClient client = highLevelClient(); - - { - CreateIndexResponse createIndexResponse = client.indices().create(new CreateIndexRequest("index"), RequestOptions.DEFAULT); - assertTrue(createIndexResponse.isAcknowledged()); - } - - { - // tag::unfreeze-index-request - UnfreezeIndexRequest request = new UnfreezeIndexRequest("index"); // <1> - // end::unfreeze-index-request - - // tag::unfreeze-index-request-timeout - request.setTimeout(TimeValue.timeValueMinutes(2)); // <1> - // end::unfreeze-index-request-timeout - // tag::unfreeze-index-request-masterTimeout - request.setMasterTimeout(TimeValue.timeValueMinutes(1)); // <1> - // end::unfreeze-index-request-masterTimeout - // tag::unfreeze-index-request-waitForActiveShards - request.setWaitForActiveShards(ActiveShardCount.DEFAULT); // <1> - // end::unfreeze-index-request-waitForActiveShards - - // tag::unfreeze-index-request-indicesOptions - request.setIndicesOptions(IndicesOptions.strictExpandOpen()); // <1> - // end::unfreeze-index-request-indicesOptions - - // tag::unfreeze-index-execute - ShardsAcknowledgedResponse openIndexResponse = client.indices().unfreeze(request, RequestOptions.DEFAULT); - // end::unfreeze-index-execute - - // tag::unfreeze-index-response - boolean acknowledged = openIndexResponse.isAcknowledged(); // <1> - boolean shardsAcked = openIndexResponse.isShardsAcknowledged(); // <2> - // end::unfreeze-index-response - assertTrue(acknowledged); - assertTrue(shardsAcked); - - // tag::unfreeze-index-execute-listener - ActionListener listener = - new ActionListener() { - @Override - public void onResponse(ShardsAcknowledgedResponse freezeIndexResponse) { - // <1> - } - - @Override - public void onFailure(Exception e) { - // <2> - } - }; - // end::unfreeze-index-execute-listener - - // Replace the empty listener by a blocking listener in test - final CountDownLatch latch = new CountDownLatch(1); - listener = new LatchedActionListener<>(listener, latch); - - // tag::unfreeze-index-execute-async - client.indices().unfreezeAsync(request, RequestOptions.DEFAULT, listener); // <1> - // end::unfreeze-index-execute-async - - assertTrue(latch.await(30L, TimeUnit.SECONDS)); - } - - { - // tag::unfreeze-index-notfound - try { - UnfreezeIndexRequest request = new UnfreezeIndexRequest("does_not_exist"); - client.indices().unfreeze(request, RequestOptions.DEFAULT); - } catch (ElasticsearchException exception) { - if (exception.status() == RestStatus.BAD_REQUEST) { - // <1> - } - } - // end::unfreeze-index-notfound - } - } - public void testDeleteTemplate() throws Exception { RestHighLevelClient client = highLevelClient(); { From c2613af190684073f65077887aef7852b3f1d416 Mon Sep 17 00:00:00 2001 From: Abbas Hussain Date: Thu, 11 Feb 2021 09:22:04 -0800 Subject: [PATCH 2/5] Remove refs from other classes --- .../elasticsearch/client/IndicesClient.java | 51 ------------------- .../client/IndicesRequestConverters.java | 26 ---------- 2 files changed, 77 deletions(-) diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesClient.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesClient.java index ff3c9fe28012b..7edaaa02d76b8 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesClient.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesClient.java @@ -55,7 +55,6 @@ import org.elasticsearch.client.indices.DeleteAliasRequest; import org.elasticsearch.client.indices.DeleteComposableIndexTemplateRequest; import org.elasticsearch.client.indices.DeleteDataStreamRequest; -import org.elasticsearch.client.indices.FreezeIndexRequest; import org.elasticsearch.client.indices.GetComposableIndexTemplateRequest; import org.elasticsearch.client.indices.GetComposableIndexTemplatesResponse; import org.elasticsearch.client.indices.GetDataStreamRequest; @@ -76,7 +75,6 @@ import org.elasticsearch.client.indices.ResizeResponse; import org.elasticsearch.client.indices.SimulateIndexTemplateRequest; import org.elasticsearch.client.indices.SimulateIndexTemplateResponse; -import org.elasticsearch.client.indices.UnfreezeIndexRequest; import org.elasticsearch.client.indices.rollover.RolloverRequest; import org.elasticsearch.client.indices.rollover.RolloverResponse; import org.elasticsearch.rest.RestStatus; @@ -1727,55 +1725,6 @@ public Cancellable analyzeAsync(AnalyzeRequest request, RequestOptions options, AnalyzeResponse::fromXContent, listener, emptySet()); } - /** - * Synchronously calls the _freeze API - * - * @param request the request - * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized - */ - public ShardsAcknowledgedResponse freeze(FreezeIndexRequest request, RequestOptions options) throws IOException { - return restHighLevelClient.performRequestAndParseEntity(request, IndicesRequestConverters::freezeIndex, options, - ShardsAcknowledgedResponse::fromXContent, emptySet()); - } - - /** - * Asynchronously calls the _freeze API - * @param request the request - * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized - * @param listener the listener to be notified upon request completion - * @return cancellable that may be used to cancel the request - */ - public Cancellable freezeAsync(FreezeIndexRequest request, RequestOptions options, - ActionListener listener) { - return restHighLevelClient.performRequestAsyncAndParseEntity(request, IndicesRequestConverters::freezeIndex, options, - ShardsAcknowledgedResponse::fromXContent, listener, emptySet()); - } - - /** - * Synchronously calls the _unfreeze API - * - * @param request the request - * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized - */ - public ShardsAcknowledgedResponse unfreeze(UnfreezeIndexRequest request, RequestOptions options) throws IOException { - return restHighLevelClient.performRequestAndParseEntity(request, IndicesRequestConverters::unfreezeIndex, options, - ShardsAcknowledgedResponse::fromXContent, emptySet()); - } - - /** - * Asynchronously calls the _unfreeze API - * @param request the request - * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized - * @param listener the listener to be notified upon request completion - * @return cancellable that may be used to cancel the request - */ - public Cancellable unfreezeAsync(UnfreezeIndexRequest request, RequestOptions options, - ActionListener listener) { - return restHighLevelClient.performRequestAsyncAndParseEntity(request, - IndicesRequestConverters::unfreezeIndex, options, - ShardsAcknowledgedResponse::fromXContent, listener, emptySet()); - } - /** * Delete an index template using the Index Templates API * See Index Templates API diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesRequestConverters.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesRequestConverters.java index f054e79977741..2a58a783139c4 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesRequestConverters.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesRequestConverters.java @@ -47,7 +47,6 @@ import org.elasticsearch.client.indices.DeleteAliasRequest; import org.elasticsearch.client.indices.DeleteComposableIndexTemplateRequest; import org.elasticsearch.client.indices.DeleteDataStreamRequest; -import org.elasticsearch.client.indices.FreezeIndexRequest; import org.elasticsearch.client.indices.GetFieldMappingsRequest; import org.elasticsearch.client.indices.GetIndexRequest; import org.elasticsearch.client.indices.GetComposableIndexTemplateRequest; @@ -60,7 +59,6 @@ import org.elasticsearch.client.indices.PutMappingRequest; import org.elasticsearch.client.indices.ResizeRequest; import org.elasticsearch.client.indices.SimulateIndexTemplateRequest; -import org.elasticsearch.client.indices.UnfreezeIndexRequest; import org.elasticsearch.client.indices.rollover.RolloverRequest; import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.Strings; @@ -761,30 +759,6 @@ static Request analyze(AnalyzeRequest request) throws IOException { return req; } - static Request freezeIndex(FreezeIndexRequest freezeIndexRequest) { - String endpoint = RequestConverters.endpoint(freezeIndexRequest.getIndices(), "_freeze"); - Request request = new Request(HttpPost.METHOD_NAME, endpoint); - RequestConverters.Params parameters = new RequestConverters.Params(); - parameters.withTimeout(freezeIndexRequest.timeout()); - parameters.withMasterTimeout(freezeIndexRequest.masterNodeTimeout()); - parameters.withIndicesOptions(freezeIndexRequest.indicesOptions()); - parameters.withWaitForActiveShards(freezeIndexRequest.getWaitForActiveShards()); - request.addParameters(parameters.asMap()); - return request; - } - - static Request unfreezeIndex(UnfreezeIndexRequest unfreezeIndexRequest) { - String endpoint = RequestConverters.endpoint(unfreezeIndexRequest.getIndices(), "_unfreeze"); - Request request = new Request(HttpPost.METHOD_NAME, endpoint); - RequestConverters.Params parameters = new RequestConverters.Params(); - parameters.withTimeout(unfreezeIndexRequest.timeout()); - parameters.withMasterTimeout(unfreezeIndexRequest.masterNodeTimeout()); - parameters.withIndicesOptions(unfreezeIndexRequest.indicesOptions()); - parameters.withWaitForActiveShards(unfreezeIndexRequest.getWaitForActiveShards()); - request.addParameters(parameters.asMap()); - return request; - } - static Request deleteTemplate(DeleteIndexTemplateRequest deleteIndexTemplateRequest) { String name = deleteIndexTemplateRequest.name(); String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_template").addPathPart(name).build(); From 50e53c6642068bcfc6f4314325725d561934033a Mon Sep 17 00:00:00 2001 From: Abbas Hussain Date: Thu, 11 Feb 2021 09:26:03 -0800 Subject: [PATCH 3/5] Remove Freeze/unfreeze request classes --- .../client/indices/FreezeIndexRequest.java | 96 ------------------ .../client/indices/UnfreezeIndexRequest.java | 97 ------------------- 2 files changed, 193 deletions(-) delete mode 100644 client/rest-high-level/src/main/java/org/elasticsearch/client/indices/FreezeIndexRequest.java delete mode 100644 client/rest-high-level/src/main/java/org/elasticsearch/client/indices/UnfreezeIndexRequest.java diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/FreezeIndexRequest.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/FreezeIndexRequest.java deleted file mode 100644 index 7e7a9d090949d..0000000000000 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/FreezeIndexRequest.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.elasticsearch.client.indices; - -import org.elasticsearch.action.admin.indices.open.OpenIndexResponse; -import org.elasticsearch.action.support.ActiveShardCount; -import org.elasticsearch.action.support.IndicesOptions; -import org.elasticsearch.client.TimedRequest; - -import java.util.Objects; - -/** - * Request for the _freeze index API - */ -public final class FreezeIndexRequest extends TimedRequest { - - private final String[] indices; - private IndicesOptions indicesOptions; - private ActiveShardCount waitForActiveShards; - - /** - * Creates a new freeze index request - * @param indices the index to freeze - */ - public FreezeIndexRequest(String... indices) { - this.indices = Objects.requireNonNull(indices); - } - - /** - * Returns the indices to freeze - */ - public String[] getIndices() { - return indices; - } - - /** - * Specifies what type of requested indices to ignore and how to deal with wildcard expressions. - * For example indices that don't exist. - * - * @return the current behaviour when it comes to index names and wildcard indices expressions - */ - public IndicesOptions indicesOptions() { - return indicesOptions; - } - - /** - * Specifies what type of requested indices to ignore and how to deal with wildcard expressions. - * For example indices that don't exist. - * - * @param indicesOptions the desired behaviour regarding indices to ignore and wildcard indices expressions - */ - public void setIndicesOptions(IndicesOptions indicesOptions) { - this.indicesOptions = indicesOptions; - } - - /** - * Returns the wait for active shard count or null if the default should be used - */ - public ActiveShardCount getWaitForActiveShards() { - return waitForActiveShards; - } - - /** - * Sets the number of shard copies that should be active for indices opening to return. - * Defaults to {@link ActiveShardCount#DEFAULT}, which will wait for one shard copy - * (the primary) to become active. Set this value to {@link ActiveShardCount#ALL} to - * wait for all shards (primary and all replicas) to be active before returning. - * Otherwise, use {@link ActiveShardCount#from(int)} to set this value to any - * non-negative integer, up to the number of copies per shard (number of replicas + 1), - * to wait for the desired amount of shard copies to become active before returning. - * Indices opening will only wait up until the timeout value for the number of shard copies - * to be active before returning. Check {@link OpenIndexResponse#isShardsAcknowledged()} to - * determine if the requisite shard copies were all started before returning or timing out. - * - * @param waitForActiveShards number of active shard copies to wait on - */ - public void setWaitForActiveShards(ActiveShardCount waitForActiveShards) { - this.waitForActiveShards = waitForActiveShards; - } -} diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/UnfreezeIndexRequest.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/UnfreezeIndexRequest.java deleted file mode 100644 index 1e2d7cded7129..0000000000000 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/UnfreezeIndexRequest.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.elasticsearch.client.indices; - -import org.elasticsearch.action.admin.indices.open.OpenIndexResponse; -import org.elasticsearch.action.support.ActiveShardCount; -import org.elasticsearch.action.support.IndicesOptions; -import org.elasticsearch.client.TimedRequest; - -import java.util.Objects; - -/** - * Request for the _unfreeze index API - */ -public final class UnfreezeIndexRequest extends TimedRequest { - - private final String[] indices; - private IndicesOptions indicesOptions; - private ActiveShardCount waitForActiveShards; - - /** - * Creates a new unfreeze index request - * @param indices the index to unfreeze - */ - public UnfreezeIndexRequest(String... indices) { - this.indices = Objects.requireNonNull(indices); - } - - /** - * Returns the indices to unfreeze - */ - public String[] getIndices() { - return indices; - } - - /** - * Specifies what type of requested indices to ignore and how to deal with wildcard expressions. - * For example indices that don't exist. - * - * @return the current behaviour when it comes to index names and wildcard indices expressions - */ - public IndicesOptions indicesOptions() { - return indicesOptions; - } - - /** - * Specifies what type of requested indices to ignore and how to deal with wildcard expressions. - * For example indices that don't exist. - * - * @param indicesOptions the desired behaviour regarding indices to ignore and wildcard indices expressions - */ - public void setIndicesOptions(IndicesOptions indicesOptions) { - this.indicesOptions = indicesOptions; - } - - /** - * Returns the wait for active shard cound or null if the default should be used - */ - public ActiveShardCount getWaitForActiveShards() { - return waitForActiveShards; - } - - /** - * Sets the number of shard copies that should be active for indices opening to return. - * Defaults to {@link ActiveShardCount#DEFAULT}, which will wait for one shard copy - * (the primary) to become active. Set this value to {@link ActiveShardCount#ALL} to - * wait for all shards (primary and all replicas) to be active before returning. - * Otherwise, use {@link ActiveShardCount#from(int)} to set this value to any - * non-negative integer, up to the number of copies per shard (number of replicas + 1), - * to wait for the desired amount of shard copies to become active before returning. - * Indices opening will only wait up until the timeout value for the number of shard copies - * to be active before returning. Check {@link OpenIndexResponse#isShardsAcknowledged()} to - * determine if the requisite shard copies were all started before returning or timing out. - * - * @param waitForActiveShards number of active shard copies to wait on - */ - public void setWaitForActiveShards(ActiveShardCount waitForActiveShards) { - this.waitForActiveShards = waitForActiveShards; - } - -} From e6e6536d59663d5724467472f59261f69d4b1219 Mon Sep 17 00:00:00 2001 From: Abbas Hussain Date: Thu, 11 Feb 2021 10:28:50 -0800 Subject: [PATCH 4/5] Remove unused imports --- .../src/main/java/org/elasticsearch/client/IndicesClient.java | 1 - 1 file changed, 1 deletion(-) diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesClient.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesClient.java index 7edaaa02d76b8..1f739f67f6554 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesClient.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesClient.java @@ -41,7 +41,6 @@ import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryRequest; import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryResponse; import org.elasticsearch.action.support.master.AcknowledgedResponse; -import org.elasticsearch.client.core.ShardsAcknowledgedResponse; import org.elasticsearch.client.indices.AnalyzeRequest; import org.elasticsearch.client.indices.AnalyzeResponse; import org.elasticsearch.client.indices.CloseIndexRequest; From 05c68ce7bfd5ccee060bb83ef1673163649f8f9a Mon Sep 17 00:00:00 2001 From: Abbas Hussain Date: Thu, 11 Feb 2021 10:38:40 -0800 Subject: [PATCH 5/5] Remove more unused import --- .../src/test/java/org/elasticsearch/client/IndicesClientIT.java | 1 - .../client/documentation/IndicesClientDocumentationIT.java | 1 - 2 files changed, 2 deletions(-) diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesClientIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesClientIT.java index 1ba90f39a8885..1586d61218a4e 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesClientIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesClientIT.java @@ -54,7 +54,6 @@ import org.elasticsearch.action.support.WriteRequest; import org.elasticsearch.action.support.broadcast.BroadcastResponse; import org.elasticsearch.action.support.master.AcknowledgedResponse; -import org.elasticsearch.client.core.ShardsAcknowledgedResponse; import org.elasticsearch.client.indices.AnalyzeRequest; import org.elasticsearch.client.indices.AnalyzeResponse; import org.elasticsearch.client.indices.CloseIndexRequest; diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/IndicesClientDocumentationIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/IndicesClientDocumentationIT.java index 87b7dfd0d1e43..c5049ff9879e0 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/IndicesClientDocumentationIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/IndicesClientDocumentationIT.java @@ -57,7 +57,6 @@ import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.client.SyncedFlushResponse; -import org.elasticsearch.client.core.ShardsAcknowledgedResponse; import org.elasticsearch.client.indices.AnalyzeRequest; import org.elasticsearch.client.indices.AnalyzeResponse; import org.elasticsearch.client.indices.CloseIndexRequest;