Skip to content

Commit

Permalink
Removing FreezeIndex related code since its x-pack counterpart is rem…
Browse files Browse the repository at this point in the history
…oved (#85)

Signed-off-by: Peter Nied <petern@amazon.com>
  • Loading branch information
abbashus authored and peternied committed Mar 13, 2021
1 parent 3b1f107 commit 5f1c8c8
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 451 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -55,7 +54,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;
Expand All @@ -76,7 +74,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;
Expand Down Expand Up @@ -1727,55 +1724,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<ShardsAcknowledgedResponse> 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<ShardsAcknowledgedResponse> listener) {
return restHighLevelClient.performRequestAsyncAndParseEntity(request,
IndicesRequestConverters::unfreezeIndex, options,
ShardsAcknowledgedResponse::fromXContent, listener, emptySet());
}

/**
* Delete an index template using the Index Templates API
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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();
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -70,7 +69,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;
Expand All @@ -90,7 +88,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;
Expand Down Expand Up @@ -1979,22 +1976,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);
Expand Down
Loading

0 comments on commit 5f1c8c8

Please sign in to comment.