diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/ClusterRequestConverters.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/ClusterRequestConverters.java
deleted file mode 100644
index 36d09cfab6f2..000000000000
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/ClusterRequestConverters.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-
-package org.elasticsearch.client;
-
-import org.apache.http.client.methods.HttpDelete;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.methods.HttpHead;
-import org.apache.http.client.methods.HttpPut;
-import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest;
-import org.elasticsearch.action.admin.cluster.settings.ClusterGetSettingsRequest;
-import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest;
-import org.elasticsearch.action.support.ActiveShardCount;
-import org.elasticsearch.client.cluster.RemoteInfoRequest;
-import org.elasticsearch.client.indices.ComponentTemplatesExistRequest;
-import org.elasticsearch.client.indices.DeleteComponentTemplateRequest;
-import org.elasticsearch.client.indices.GetComponentTemplatesRequest;
-import org.elasticsearch.client.indices.PutComponentTemplateRequest;
-import org.elasticsearch.common.Strings;
-
-import java.io.IOException;
-
-final class ClusterRequestConverters {
-
- private ClusterRequestConverters() {}
-
- static Request clusterPutSettings(ClusterUpdateSettingsRequest clusterUpdateSettingsRequest) throws IOException {
- Request request = new Request(HttpPut.METHOD_NAME, "/_cluster/settings");
-
- RequestConverters.Params parameters = new RequestConverters.Params();
- parameters.withTimeout(clusterUpdateSettingsRequest.timeout());
- parameters.withMasterTimeout(clusterUpdateSettingsRequest.masterNodeTimeout());
- request.addParameters(parameters.asMap());
- request.setEntity(RequestConverters.createEntity(clusterUpdateSettingsRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
- return request;
- }
-
- static Request clusterGetSettings(ClusterGetSettingsRequest clusterGetSettingsRequest) throws IOException {
- Request request = new Request(HttpGet.METHOD_NAME, "/_cluster/settings");
- RequestConverters.Params parameters = new RequestConverters.Params();
- parameters.withLocal(clusterGetSettingsRequest.local());
- parameters.withIncludeDefaults(clusterGetSettingsRequest.includeDefaults());
- parameters.withMasterTimeout(clusterGetSettingsRequest.masterNodeTimeout());
- request.addParameters(parameters.asMap());
- 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);
-
- RequestConverters.Params params = new RequestConverters.Params().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());
- request.addParameters(params.asMap());
- return request;
- }
-
- static Request remoteInfo(RemoteInfoRequest remoteInfoRequest) {
- return new Request(HttpGet.METHOD_NAME, "/_remote/info");
- }
-
- static Request putComponentTemplate(PutComponentTemplateRequest putComponentTemplateRequest) throws IOException {
- String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_component_template")
- .addPathPart(putComponentTemplateRequest.name())
- .build();
- Request request = new Request(HttpPut.METHOD_NAME, endpoint);
- RequestConverters.Params params = new RequestConverters.Params();
- params.withMasterTimeout(putComponentTemplateRequest.masterNodeTimeout());
- if (putComponentTemplateRequest.create()) {
- params.putParam("create", Boolean.TRUE.toString());
- }
- if (Strings.hasText(putComponentTemplateRequest.cause())) {
- params.putParam("cause", putComponentTemplateRequest.cause());
- }
- request.addParameters(params.asMap());
- request.setEntity(RequestConverters.createEntity(putComponentTemplateRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
- return request;
- }
-
- static Request getComponentTemplates(GetComponentTemplatesRequest getComponentTemplatesRequest) {
- final String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_component_template")
- .addPathPart(getComponentTemplatesRequest.name())
- .build();
- final Request request = new Request(HttpGet.METHOD_NAME, endpoint);
- final RequestConverters.Params params = new RequestConverters.Params();
- params.withLocal(getComponentTemplatesRequest.isLocal());
- params.withMasterTimeout(getComponentTemplatesRequest.getMasterNodeTimeout());
- request.addParameters(params.asMap());
- return request;
- }
-
- static Request componentTemplatesExist(ComponentTemplatesExistRequest componentTemplatesRequest) {
- final String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_component_template")
- .addPathPart(componentTemplatesRequest.name())
- .build();
- final Request request = new Request(HttpHead.METHOD_NAME, endpoint);
- final RequestConverters.Params params = new RequestConverters.Params();
- params.withLocal(componentTemplatesRequest.isLocal());
- params.withMasterTimeout(componentTemplatesRequest.getMasterNodeTimeout());
- request.addParameters(params.asMap());
- return request;
- }
-
- static Request deleteComponentTemplate(DeleteComponentTemplateRequest deleteComponentTemplateRequest) {
- String name = deleteComponentTemplateRequest.getName();
- String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_component_template").addPathPart(name).build();
- Request request = new Request(HttpDelete.METHOD_NAME, endpoint);
- RequestConverters.Params params = new RequestConverters.Params();
- params.withMasterTimeout(deleteComponentTemplateRequest.masterNodeTimeout());
- request.addParameters(params.asMap());
- return request;
- }
-}
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
deleted file mode 100644
index afb876eda139..000000000000
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesClient.java
+++ /dev/null
@@ -1,2006 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-
-package org.elasticsearch.client;
-
-import org.elasticsearch.action.ActionListener;
-import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
-import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
-import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheRequest;
-import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheResponse;
-import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
-import org.elasticsearch.action.admin.indices.flush.FlushRequest;
-import org.elasticsearch.action.admin.indices.flush.FlushResponse;
-import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeRequest;
-import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeResponse;
-import org.elasticsearch.action.admin.indices.open.OpenIndexRequest;
-import org.elasticsearch.action.admin.indices.open.OpenIndexResponse;
-import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
-import org.elasticsearch.action.admin.indices.refresh.RefreshResponse;
-import org.elasticsearch.action.admin.indices.settings.get.GetSettingsRequest;
-import org.elasticsearch.action.admin.indices.settings.get.GetSettingsResponse;
-import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequest;
-import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateRequest;
-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;
-import org.elasticsearch.client.indices.CloseIndexResponse;
-import org.elasticsearch.client.indices.ComposableIndexTemplateExistRequest;
-import org.elasticsearch.client.indices.CreateDataStreamRequest;
-import org.elasticsearch.client.indices.CreateIndexRequest;
-import org.elasticsearch.client.indices.CreateIndexResponse;
-import org.elasticsearch.client.indices.DataStreamsStatsRequest;
-import org.elasticsearch.client.indices.DataStreamsStatsResponse;
-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;
-import org.elasticsearch.client.indices.GetDataStreamResponse;
-import org.elasticsearch.client.indices.GetFieldMappingsRequest;
-import org.elasticsearch.client.indices.GetFieldMappingsResponse;
-import org.elasticsearch.client.indices.GetIndexRequest;
-import org.elasticsearch.client.indices.GetIndexResponse;
-import org.elasticsearch.client.indices.GetIndexTemplatesRequest;
-import org.elasticsearch.client.indices.GetIndexTemplatesResponse;
-import org.elasticsearch.client.indices.GetMappingsRequest;
-import org.elasticsearch.client.indices.GetMappingsResponse;
-import org.elasticsearch.client.indices.IndexTemplatesExistRequest;
-import org.elasticsearch.client.indices.PutComposableIndexTemplateRequest;
-import org.elasticsearch.client.indices.PutIndexTemplateRequest;
-import org.elasticsearch.client.indices.PutMappingRequest;
-import org.elasticsearch.client.indices.ReloadAnalyzersRequest;
-import org.elasticsearch.client.indices.ReloadAnalyzersResponse;
-import org.elasticsearch.client.indices.ResizeRequest;
-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;
-
-import java.io.IOException;
-import java.util.Collections;
-
-import static java.util.Collections.emptySet;
-import static java.util.Collections.singleton;
-
-/**
- * A wrapper for the {@link RestHighLevelClient} that provides methods for accessing the Indices API.
- *
- * See Indices API on elastic.co
- *
- * @deprecated The High Level Rest Client is deprecated in favor of the
- *
- * Elasticsearch Java API Client
- */
-@Deprecated(since = "7.16.0", forRemoval = true)
-@SuppressWarnings("removal")
-public final class IndicesClient {
- private final RestHighLevelClient restHighLevelClient;
-
- IndicesClient(RestHighLevelClient restHighLevelClient) {
- this.restHighLevelClient = restHighLevelClient;
- }
-
- /**
- * Deletes an index using the Delete Index API.
- * See
- * Delete Index API on elastic.co
- * @param deleteIndexRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public AcknowledgedResponse delete(DeleteIndexRequest deleteIndexRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- deleteIndexRequest,
- IndicesRequestConverters::deleteIndex,
- options,
- AcknowledgedResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously deletes an index using the Delete Index API.
- * See
- * Delete Index API on elastic.co
- * @param deleteIndexRequest 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 deleteAsync(
- DeleteIndexRequest deleteIndexRequest,
- RequestOptions options,
- ActionListener listener
- ) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- deleteIndexRequest,
- IndicesRequestConverters::deleteIndex,
- options,
- AcknowledgedResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Creates an index using the Create Index API.
- * See
- * Create Index API on elastic.co
- * @param createIndexRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public CreateIndexResponse create(CreateIndexRequest createIndexRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- createIndexRequest,
- IndicesRequestConverters::createIndex,
- options,
- CreateIndexResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously creates an index using the Create Index API.
- * See
- * Create Index API on elastic.co
- * @param createIndexRequest 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 createAsync(
- CreateIndexRequest createIndexRequest,
- RequestOptions options,
- ActionListener listener
- ) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- createIndexRequest,
- IndicesRequestConverters::createIndex,
- options,
- CreateIndexResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Creates a data stream using the Create Data Stream API.
- * See
- * Data Streams API on elastic.co
- *
- * @param createDataStreamRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be
- * customized
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public AcknowledgedResponse createDataStream(CreateDataStreamRequest createDataStreamRequest, RequestOptions options)
- throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- createDataStreamRequest,
- IndicesRequestConverters::putDataStream,
- options,
- AcknowledgedResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously creates a data stream using the Create Data Stream API.
- * See
- * Data Streams API on elastic.co
- *
- * @param createDataStreamRequest 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 createDataStreamAsync(
- CreateDataStreamRequest createDataStreamRequest,
- RequestOptions options,
- ActionListener listener
- ) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- createDataStreamRequest,
- IndicesRequestConverters::putDataStream,
- options,
- AcknowledgedResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Deletes a data stream using the Delete Data Stream API.
- * See
- * Data Streams API on elastic.co
- *
- * @param deleteDataStreamRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be
- * customized
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public AcknowledgedResponse deleteDataStream(DeleteDataStreamRequest deleteDataStreamRequest, RequestOptions options)
- throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- deleteDataStreamRequest,
- IndicesRequestConverters::deleteDataStream,
- options,
- AcknowledgedResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously deletes a data stream using the Delete Data Stream API.
- * See
- * Data Streams API on elastic.co
- *
- * @param deleteDataStreamRequest 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 deleteDataStreamAsync(
- DeleteDataStreamRequest deleteDataStreamRequest,
- RequestOptions options,
- ActionListener listener
- ) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- deleteDataStreamRequest,
- IndicesRequestConverters::deleteDataStream,
- options,
- AcknowledgedResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Gets one or more data streams using the Get Data Stream API.
- * See Data Streams API on
- * elastic.co
- *
- * @param dataStreamRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public GetDataStreamResponse getDataStream(GetDataStreamRequest dataStreamRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- dataStreamRequest,
- IndicesRequestConverters::getDataStreams,
- options,
- GetDataStreamResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously gets one or more data streams using the Get Data Stream API.
- * See Data Streams API on
- * elastic.co
- *
- * @param dataStreamRequest 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 getDataStreamAsync(
- GetDataStreamRequest dataStreamRequest,
- RequestOptions options,
- ActionListener listener
- ) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- dataStreamRequest,
- IndicesRequestConverters::getDataStreams,
- options,
- GetDataStreamResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Gets statistics about one or more data streams using the Get Data Streams Stats API.
- * See Data Streams API on
- * elastic.co
- *
- * @param dataStreamsStatsRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be
- * customized
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public DataStreamsStatsResponse dataStreamsStats(DataStreamsStatsRequest dataStreamsStatsRequest, RequestOptions options)
- throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- dataStreamsStatsRequest,
- IndicesRequestConverters::dataStreamsStats,
- options,
- DataStreamsStatsResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously gets statistics about one or more data streams using the Get Data Streams Stats API.
- * See Data Streams API on
- * elastic.co
- *
- * @param dataStreamsStatsRequest 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 dataStreamsStatsAsync(
- DataStreamsStatsRequest dataStreamsStatsRequest,
- RequestOptions options,
- ActionListener listener
- ) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- dataStreamsStatsRequest,
- IndicesRequestConverters::dataStreamsStats,
- options,
- DataStreamsStatsResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Updates the mappings on an index using the Put Mapping API.
- * See
- * Put Mapping API on elastic.co
- * @param putMappingRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public AcknowledgedResponse putMapping(PutMappingRequest putMappingRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- putMappingRequest,
- IndicesRequestConverters::putMapping,
- options,
- AcknowledgedResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously updates the mappings on an index using the Put Mapping API.
- * See
- * Put Mapping API on elastic.co
- * @param putMappingRequest 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 putMappingAsync(
- PutMappingRequest putMappingRequest,
- RequestOptions options,
- ActionListener listener
- ) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- putMappingRequest,
- IndicesRequestConverters::putMapping,
- options,
- AcknowledgedResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Retrieves the mappings on an index or indices using the Get Mapping API.
- * See
- * Get Mapping API on elastic.co
- * @param getMappingsRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public GetMappingsResponse getMapping(GetMappingsRequest getMappingsRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- getMappingsRequest,
- IndicesRequestConverters::getMappings,
- options,
- GetMappingsResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously retrieves the mappings on an index on indices using the Get Mapping API.
- * See
- * Get Mapping API on elastic.co
- * @param getMappingsRequest 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 getMappingAsync(
- GetMappingsRequest getMappingsRequest,
- RequestOptions options,
- ActionListener listener
- ) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- getMappingsRequest,
- IndicesRequestConverters::getMappings,
- options,
- GetMappingsResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Retrieves the field mappings on an index or indices using the Get Field Mapping API.
- * See
- * Get Field Mapping API on elastic.co
- * @param getFieldMappingsRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public GetFieldMappingsResponse getFieldMapping(GetFieldMappingsRequest getFieldMappingsRequest, RequestOptions options)
- throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- getFieldMappingsRequest,
- IndicesRequestConverters::getFieldMapping,
- options,
- GetFieldMappingsResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously retrieves the field mappings on an index or indices using the Get Field Mapping API.
- * See
- * Get Field Mapping API on elastic.co
- * @param getFieldMappingsRequest 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 getFieldMappingAsync(
- GetFieldMappingsRequest getFieldMappingsRequest,
- RequestOptions options,
- ActionListener listener
- ) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- getFieldMappingsRequest,
- IndicesRequestConverters::getFieldMapping,
- options,
- GetFieldMappingsResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Updates aliases using the Index Aliases API.
- * See
- * Index Aliases API on elastic.co
- * @param indicesAliasesRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public AcknowledgedResponse updateAliases(IndicesAliasesRequest indicesAliasesRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- indicesAliasesRequest,
- IndicesRequestConverters::updateAliases,
- options,
- AcknowledgedResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously updates aliases using the Index Aliases API.
- * See
- * Index Aliases API on elastic.co
- * @param indicesAliasesRequest 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 updateAliasesAsync(
- IndicesAliasesRequest indicesAliasesRequest,
- RequestOptions options,
- ActionListener listener
- ) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- indicesAliasesRequest,
- IndicesRequestConverters::updateAliases,
- options,
- AcknowledgedResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Opens an index using the Open Index API.
- * See
- * Open Index API on elastic.co
- * @param openIndexRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public OpenIndexResponse open(OpenIndexRequest openIndexRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- openIndexRequest,
- IndicesRequestConverters::openIndex,
- options,
- OpenIndexResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously opens an index using the Open Index API.
- * See
- * Open Index API on elastic.co
- * @param openIndexRequest 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 openAsync(OpenIndexRequest openIndexRequest, RequestOptions options, ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- openIndexRequest,
- IndicesRequestConverters::openIndex,
- options,
- OpenIndexResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Closes an index using the Close Index API.
- * See
- * Close Index API on elastic.co
- * @param closeIndexRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public CloseIndexResponse close(CloseIndexRequest closeIndexRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- closeIndexRequest,
- IndicesRequestConverters::closeIndex,
- options,
- CloseIndexResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously closes an index using the Close Index API.
- * See
- * Close Index API on elastic.co
- * @param closeIndexRequest 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 closeAsync(
- CloseIndexRequest closeIndexRequest,
- RequestOptions options,
- ActionListener listener
- ) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- closeIndexRequest,
- IndicesRequestConverters::closeIndex,
- options,
- CloseIndexResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Checks if one or more aliases exist using the Aliases Exist API.
- * See
- * Indices Aliases API on elastic.co
- * @param getAliasesRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return the response
- * @throws IOException in case there is a problem sending the request
- */
- public boolean existsAlias(GetAliasesRequest getAliasesRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequest(
- getAliasesRequest,
- IndicesRequestConverters::existsAlias,
- options,
- RestHighLevelClient::convertExistsResponse,
- emptySet()
- );
- }
-
- /**
- * Asynchronously checks if one or more aliases exist using the Aliases Exist API.
- * See
- * Indices Aliases API on elastic.co
- * @param getAliasesRequest 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 existsAliasAsync(GetAliasesRequest getAliasesRequest, RequestOptions options, ActionListener listener) {
- return restHighLevelClient.performRequestAsync(
- getAliasesRequest,
- IndicesRequestConverters::existsAlias,
- options,
- RestHighLevelClient::convertExistsResponse,
- listener,
- emptySet()
- );
- }
-
- /**
- * Refresh one or more indices using the Refresh API.
- * See Refresh API on elastic.co
- * @param refreshRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public RefreshResponse refresh(RefreshRequest refreshRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- refreshRequest,
- IndicesRequestConverters::refresh,
- options,
- RefreshResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously refresh one or more indices using the Refresh API.
- * See Refresh API on elastic.co
- * @param refreshRequest 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 refreshAsync(RefreshRequest refreshRequest, RequestOptions options, ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- refreshRequest,
- IndicesRequestConverters::refresh,
- options,
- RefreshResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Flush one or more indices using the Flush API.
- * See Flush API on elastic.co
- * @param flushRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public FlushResponse flush(FlushRequest flushRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- flushRequest,
- IndicesRequestConverters::flush,
- options,
- FlushResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously flush one or more indices using the Flush API.
- * See Flush API on elastic.co
- * @param flushRequest 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 flushAsync(FlushRequest flushRequest, RequestOptions options, ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- flushRequest,
- IndicesRequestConverters::flush,
- options,
- FlushResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Retrieve the settings of one or more indices.
- * See
- * Indices Get Settings API on elastic.co
- * @param getSettingsRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public GetSettingsResponse getSettings(GetSettingsRequest getSettingsRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- getSettingsRequest,
- IndicesRequestConverters::getSettings,
- options,
- GetSettingsResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously retrieve the settings of one or more indices.
- * See
- * Indices Get Settings API on elastic.co
- * @param getSettingsRequest 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 getSettingsAsync(
- GetSettingsRequest getSettingsRequest,
- RequestOptions options,
- ActionListener listener
- ) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- getSettingsRequest,
- IndicesRequestConverters::getSettings,
- options,
- GetSettingsResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Retrieve information about one or more indexes
- * See
- * Indices Get Index API on elastic.co
- * @param getIndexRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public GetIndexResponse get(GetIndexRequest getIndexRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- getIndexRequest,
- IndicesRequestConverters::getIndex,
- options,
- GetIndexResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Retrieve information about one or more indexes
- * See
- * Indices Get Index API on elastic.co
- * @param getIndexRequest 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 getAsync(GetIndexRequest getIndexRequest, RequestOptions options, ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- getIndexRequest,
- IndicesRequestConverters::getIndex,
- options,
- GetIndexResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Force merge one or more indices using the Force Merge API.
- * See
- * Force Merge API on elastic.co
- * @param forceMergeRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- * @deprecated use {@link #forcemerge(ForceMergeRequest, RequestOptions)} instead
- */
- @Deprecated
- public ForceMergeResponse forceMerge(ForceMergeRequest forceMergeRequest, RequestOptions options) throws IOException {
- return forcemerge(forceMergeRequest, options);
- }
-
- /**
- * Force merge one or more indices using the Force Merge API.
- * See
- * Force Merge API on elastic.co
- * @param forceMergeRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public ForceMergeResponse forcemerge(ForceMergeRequest forceMergeRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- forceMergeRequest,
- IndicesRequestConverters::forceMerge,
- options,
- ForceMergeResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously force merge one or more indices using the Force Merge API.
- * See
- * Force Merge API on elastic.co
- * @param forceMergeRequest 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
- * @deprecated use {@link #forcemergeAsync(ForceMergeRequest, RequestOptions, ActionListener)} instead
- * @return cancellable that may be used to cancel the request
- */
- @Deprecated
- public Cancellable forceMergeAsync(
- ForceMergeRequest forceMergeRequest,
- RequestOptions options,
- ActionListener listener
- ) {
- return forcemergeAsync(forceMergeRequest, options, listener);
- }
-
- /**
- * Asynchronously force merge one or more indices using the Force Merge API.
- * See
- * Force Merge API on elastic.co
- * @param forceMergeRequest 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 forcemergeAsync(
- ForceMergeRequest forceMergeRequest,
- RequestOptions options,
- ActionListener listener
- ) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- forceMergeRequest,
- IndicesRequestConverters::forceMerge,
- options,
- ForceMergeResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Clears the cache of one or more indices using the Clear Cache API.
- * See
- * Clear Cache API on elastic.co
- * @param clearIndicesCacheRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public ClearIndicesCacheResponse clearCache(ClearIndicesCacheRequest clearIndicesCacheRequest, RequestOptions options)
- throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- clearIndicesCacheRequest,
- IndicesRequestConverters::clearCache,
- options,
- ClearIndicesCacheResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously clears the cache of one or more indices using the Clear Cache API.
- * See
- * Clear Cache API on elastic.co
- * @param clearIndicesCacheRequest 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 clearCacheAsync(
- ClearIndicesCacheRequest clearIndicesCacheRequest,
- RequestOptions options,
- ActionListener listener
- ) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- clearIndicesCacheRequest,
- IndicesRequestConverters::clearCache,
- options,
- ClearIndicesCacheResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Checks if the index (indices) exists or not.
- * See
- * Indices Exists API on elastic.co
- * @param request the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return the response
- * @throws IOException in case there is a problem sending the request
- */
- public boolean exists(GetIndexRequest request, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequest(
- request,
- IndicesRequestConverters::indicesExist,
- options,
- RestHighLevelClient::convertExistsResponse,
- Collections.emptySet()
- );
- }
-
- /**
- * Asynchronously checks if the index (indices) exists or not.
- * See
- * Indices Exists API on elastic.co
- * @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 existsAsync(GetIndexRequest request, RequestOptions options, ActionListener listener) {
- return restHighLevelClient.performRequestAsync(
- request,
- IndicesRequestConverters::indicesExist,
- options,
- RestHighLevelClient::convertExistsResponse,
- listener,
- Collections.emptySet()
- );
- }
-
- /**
- * Shrinks an index using the Shrink Index API.
- * See
- * Shrink Index API on elastic.co
- * @param resizeRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public ResizeResponse shrink(ResizeRequest resizeRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- resizeRequest,
- IndicesRequestConverters::shrink,
- options,
- ResizeResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Shrinks an index using the Shrink Index API.
- * See
- * Shrink Index API on elastic.co
- * @param resizeRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- * @deprecated use {@link #shrink(ResizeRequest, RequestOptions)}
- */
- @Deprecated
- public org.elasticsearch.action.admin.indices.shrink.ResizeResponse shrink(
- org.elasticsearch.action.admin.indices.shrink.ResizeRequest resizeRequest,
- RequestOptions options
- ) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- resizeRequest,
- IndicesRequestConverters::shrink,
- options,
- org.elasticsearch.action.admin.indices.shrink.ResizeResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously shrinks an index using the Shrink index API.
- * See
- * Shrink Index API on elastic.co
- * @param resizeRequest 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 shrinkAsync(ResizeRequest resizeRequest, RequestOptions options, ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- resizeRequest,
- IndicesRequestConverters::shrink,
- options,
- ResizeResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Asynchronously shrinks an index using the Shrink index API.
- * See
- * Shrink Index API on elastic.co
- * @param resizeRequest 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
- * @deprecated use {@link #shrinkAsync(ResizeRequest, RequestOptions, ActionListener)}
- */
- @Deprecated
- public Cancellable shrinkAsync(
- org.elasticsearch.action.admin.indices.shrink.ResizeRequest resizeRequest,
- RequestOptions options,
- ActionListener listener
- ) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- resizeRequest,
- IndicesRequestConverters::shrink,
- options,
- org.elasticsearch.action.admin.indices.shrink.ResizeResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Splits an index using the Split Index API.
- * See
- * Split Index API on elastic.co
- * @param resizeRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public ResizeResponse split(ResizeRequest resizeRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- resizeRequest,
- IndicesRequestConverters::split,
- options,
- ResizeResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Splits an index using the Split Index API.
- * See
- * Split Index API on elastic.co
- * @param resizeRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- * @deprecated use {@link #split(ResizeRequest, RequestOptions)}
- */
- @Deprecated
- public org.elasticsearch.action.admin.indices.shrink.ResizeResponse split(
- org.elasticsearch.action.admin.indices.shrink.ResizeRequest resizeRequest,
- RequestOptions options
- ) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- resizeRequest,
- IndicesRequestConverters::split,
- options,
- org.elasticsearch.action.admin.indices.shrink.ResizeResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously splits an index using the Split Index API.
- * See
- * Split Index API on elastic.co
- * @param resizeRequest 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 splitAsync(ResizeRequest resizeRequest, RequestOptions options, ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- resizeRequest,
- IndicesRequestConverters::split,
- options,
- ResizeResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Asynchronously splits an index using the Split Index API.
- * See
- * Split Index API on elastic.co
- * @param resizeRequest 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
- * @deprecated use {@link #splitAsync(ResizeRequest, RequestOptions, ActionListener)}
- */
- @Deprecated
- public Cancellable splitAsync(
- org.elasticsearch.action.admin.indices.shrink.ResizeRequest resizeRequest,
- RequestOptions options,
- ActionListener listener
- ) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- resizeRequest,
- IndicesRequestConverters::split,
- options,
- org.elasticsearch.action.admin.indices.shrink.ResizeResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Clones an index using the Clone Index API.
- * See
- * Clone Index API on elastic.co
- * @param resizeRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public ResizeResponse clone(ResizeRequest resizeRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- resizeRequest,
- IndicesRequestConverters::clone,
- options,
- ResizeResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Clones an index using the Clone Index API.
- * See
- * Clone Index API on elastic.co
- * @param resizeRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- * @deprecated use {@link #clone(ResizeRequest, RequestOptions)}
- */
- @Deprecated
- public org.elasticsearch.action.admin.indices.shrink.ResizeResponse clone(
- org.elasticsearch.action.admin.indices.shrink.ResizeRequest resizeRequest,
- RequestOptions options
- ) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- resizeRequest,
- IndicesRequestConverters::clone,
- options,
- org.elasticsearch.action.admin.indices.shrink.ResizeResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously clones an index using the Clone Index API.
- * See
- * Clone Index API on elastic.co
- * @param resizeRequest 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 cloneAsync(ResizeRequest resizeRequest, RequestOptions options, ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- resizeRequest,
- IndicesRequestConverters::clone,
- options,
- ResizeResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Asynchronously clones an index using the Clone Index API.
- * See
- * Clone Index API on elastic.co
- * @param resizeRequest 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
- * @deprecated use {@link #cloneAsync(ResizeRequest, RequestOptions, ActionListener)}
- */
- @Deprecated
- public Cancellable cloneAsync(
- org.elasticsearch.action.admin.indices.shrink.ResizeRequest resizeRequest,
- RequestOptions options,
- ActionListener listener
- ) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- resizeRequest,
- IndicesRequestConverters::clone,
- options,
- org.elasticsearch.action.admin.indices.shrink.ResizeResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Rolls over an index using the Rollover Index API.
- * See
- * Rollover Index API on elastic.co
- * @param rolloverRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public RolloverResponse rollover(RolloverRequest rolloverRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- rolloverRequest,
- IndicesRequestConverters::rollover,
- options,
- RolloverResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously rolls over an index using the Rollover Index API.
- * See
- * Rollover Index API on elastic.co
- * @param rolloverRequest 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 rolloverAsync(RolloverRequest rolloverRequest, RequestOptions options, ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- rolloverRequest,
- IndicesRequestConverters::rollover,
- options,
- RolloverResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Gets one or more aliases using the Get Index Aliases API.
- * See Indices Aliases API on
- * elastic.co
- * @param getAliasesRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public GetAliasesResponse getAlias(GetAliasesRequest getAliasesRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- getAliasesRequest,
- IndicesRequestConverters::getAlias,
- options,
- GetAliasesResponse::fromXContent,
- singleton(RestStatus.NOT_FOUND.getStatus())
- );
- }
-
- /**
- * Asynchronously gets one or more aliases using the Get Index Aliases API.
- * See Indices Aliases API on
- * elastic.co
- * @param getAliasesRequest 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 getAliasAsync(
- GetAliasesRequest getAliasesRequest,
- RequestOptions options,
- ActionListener listener
- ) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- getAliasesRequest,
- IndicesRequestConverters::getAlias,
- options,
- GetAliasesResponse::fromXContent,
- listener,
- singleton(RestStatus.NOT_FOUND.getStatus())
- );
- }
-
- /**
- * Updates specific index level settings using the Update Indices Settings API.
- * See Update Indices Settings
- * API on elastic.co
- * @param updateSettingsRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public AcknowledgedResponse putSettings(UpdateSettingsRequest updateSettingsRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- updateSettingsRequest,
- IndicesRequestConverters::indexPutSettings,
- options,
- AcknowledgedResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously updates specific index level settings using the Update Indices Settings API.
- * See Update Indices Settings
- * API on elastic.co
- * @param updateSettingsRequest 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 putSettingsAsync(
- UpdateSettingsRequest updateSettingsRequest,
- RequestOptions options,
- ActionListener listener
- ) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- updateSettingsRequest,
- IndicesRequestConverters::indexPutSettings,
- options,
- AcknowledgedResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Puts an index template using the Index Templates API.
- * See Index Templates API
- * on elastic.co
- * @param putIndexTemplateRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public AcknowledgedResponse putTemplate(PutIndexTemplateRequest putIndexTemplateRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- putIndexTemplateRequest,
- IndicesRequestConverters::putTemplate,
- options,
- AcknowledgedResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously puts an index template using the Index Templates API.
- * See Index Templates API
- * on elastic.co
- * @param putIndexTemplateRequest 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 putTemplateAsync(
- PutIndexTemplateRequest putIndexTemplateRequest,
- RequestOptions options,
- ActionListener listener
- ) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- putIndexTemplateRequest,
- IndicesRequestConverters::putTemplate,
- options,
- AcknowledgedResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Puts an index template using the Index Templates API.
- * See Index Templates API
- * on elastic.co
- * @param putIndexTemplateRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public AcknowledgedResponse putIndexTemplate(PutComposableIndexTemplateRequest putIndexTemplateRequest, RequestOptions options)
- throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- putIndexTemplateRequest,
- IndicesRequestConverters::putIndexTemplate,
- options,
- AcknowledgedResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously puts an index template using the Index Templates API.
- * See Index Templates API
- * on elastic.co
- * @param putIndexTemplateRequest 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 putIndexTemplateAsync(
- PutComposableIndexTemplateRequest putIndexTemplateRequest,
- RequestOptions options,
- ActionListener listener
- ) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- putIndexTemplateRequest,
- IndicesRequestConverters::putIndexTemplate,
- options,
- AcknowledgedResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Simulates matching index name against the existing index templates in the system.
- * See Index Templates API
- * on elastic.co
- *
- * @param simulateIndexTemplateRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be
- * customized
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public SimulateIndexTemplateResponse simulateIndexTemplate(
- SimulateIndexTemplateRequest simulateIndexTemplateRequest,
- RequestOptions options
- ) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- simulateIndexTemplateRequest,
- IndicesRequestConverters::simulateIndexTemplate,
- options,
- SimulateIndexTemplateResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously simulates matching index name against the existing index templates in the system.
- * See Index Templates API
- * on elastic.co
- *
- * @param simulateIndexTemplateRequest 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 simulateIndexTemplateAsync(
- SimulateIndexTemplateRequest simulateIndexTemplateRequest,
- RequestOptions options,
- ActionListener listener
- ) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- simulateIndexTemplateRequest,
- IndicesRequestConverters::simulateIndexTemplate,
- options,
- SimulateIndexTemplateResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Validate a potentially expensive query without executing it.
- *
- * See Validate Query API
- * on elastic.co
- * @param validateQueryRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public ValidateQueryResponse validateQuery(ValidateQueryRequest validateQueryRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- validateQueryRequest,
- IndicesRequestConverters::validateQuery,
- options,
- ValidateQueryResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously validate a potentially expensive query without executing it.
- *
- * See Validate Query API
- * on elastic.co
- * @param validateQueryRequest 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 validateQueryAsync(
- ValidateQueryRequest validateQueryRequest,
- RequestOptions options,
- ActionListener listener
- ) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- validateQueryRequest,
- IndicesRequestConverters::validateQuery,
- options,
- ValidateQueryResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Gets index templates using the Index Templates API
- * See Index Templates API
- * on elastic.co
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @param getIndexTemplatesRequest the request
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public GetComposableIndexTemplatesResponse getIndexTemplate(
- GetComposableIndexTemplateRequest getIndexTemplatesRequest,
- RequestOptions options
- ) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- getIndexTemplatesRequest,
- IndicesRequestConverters::getIndexTemplates,
- options,
- GetComposableIndexTemplatesResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously gets index templates using the Index Templates API
- * See Index Templates API
- * on elastic.co
- * @param getIndexTemplatesRequest 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 getIndexTemplateAsync(
- GetComposableIndexTemplateRequest getIndexTemplatesRequest,
- RequestOptions options,
- ActionListener listener
- ) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- getIndexTemplatesRequest,
- IndicesRequestConverters::getIndexTemplates,
- options,
- GetComposableIndexTemplatesResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Gets index templates using the Index Templates API
- * See Index Templates API
- * on elastic.co
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @param getIndexTemplatesRequest the request
- * @return the response
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public GetIndexTemplatesResponse getIndexTemplate(GetIndexTemplatesRequest getIndexTemplatesRequest, RequestOptions options)
- throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- getIndexTemplatesRequest,
- IndicesRequestConverters::getTemplates,
- options,
- GetIndexTemplatesResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously gets index templates using the Index Templates API
- * See Index Templates API
- * on elastic.co
- * @param getIndexTemplatesRequest 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 getIndexTemplateAsync(
- GetIndexTemplatesRequest getIndexTemplatesRequest,
- RequestOptions options,
- ActionListener listener
- ) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- getIndexTemplatesRequest,
- IndicesRequestConverters::getTemplates,
- options,
- GetIndexTemplatesResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Uses the Index Templates API to determine if index templates exist
- *
- * @param indexTemplatesRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return true if any index templates in the request exist, false otherwise
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public boolean existsTemplate(IndexTemplatesExistRequest indexTemplatesRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequest(
- indexTemplatesRequest,
- IndicesRequestConverters::templatesExist,
- options,
- RestHighLevelClient::convertExistsResponse,
- emptySet()
- );
- }
-
- /**
- * Uses the Index Templates API to determine if index templates exist
- * @param indexTemplatesExistRequest 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. The listener will be called with the value {@code true}
- * @return cancellable that may be used to cancel the request
- */
- public Cancellable existsTemplateAsync(
- IndexTemplatesExistRequest indexTemplatesExistRequest,
- RequestOptions options,
- ActionListener listener
- ) {
-
- return restHighLevelClient.performRequestAsync(
- indexTemplatesExistRequest,
- IndicesRequestConverters::templatesExist,
- options,
- RestHighLevelClient::convertExistsResponse,
- listener,
- emptySet()
- );
- }
-
- /**
- * Uses the Index Templates API to determine if index templates exist
- *
- * @param indexTemplatesRequest the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @return true if any index templates in the request exist, false otherwise
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public boolean existsIndexTemplate(ComposableIndexTemplateExistRequest indexTemplatesRequest, RequestOptions options)
- throws IOException {
- return restHighLevelClient.performRequest(
- indexTemplatesRequest,
- IndicesRequestConverters::templatesExist,
- options,
- RestHighLevelClient::convertExistsResponse,
- emptySet()
- );
- }
-
- /**
- * Uses the Index Templates API to determine if index templates exist
- * @param indexTemplatesExistRequest 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. The listener will be called with the value {@code true}
- * @return cancellable that may be used to cancel the request
- */
- public Cancellable existsIndexTemplateAsync(
- ComposableIndexTemplateExistRequest indexTemplatesExistRequest,
- RequestOptions options,
- ActionListener listener
- ) {
-
- return restHighLevelClient.performRequestAsync(
- indexTemplatesExistRequest,
- IndicesRequestConverters::templatesExist,
- options,
- RestHighLevelClient::convertExistsResponse,
- listener,
- emptySet()
- );
- }
-
- /**
- * Calls the analyze API
- *
- * See Analyze API on elastic.co
- *
- * @param request the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- */
- public AnalyzeResponse analyze(AnalyzeRequest request, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- request,
- IndicesRequestConverters::analyze,
- options,
- AnalyzeResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously calls the analyze API
- *
- * See Analyze API on elastic.co
- * @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 analyzeAsync(AnalyzeRequest request, RequestOptions options, ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- request,
- IndicesRequestConverters::analyze,
- 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
- * on elastic.co
- *
- * @param request the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public AcknowledgedResponse deleteTemplate(DeleteIndexTemplateRequest request, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- request,
- IndicesRequestConverters::deleteTemplate,
- options,
- AcknowledgedResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously delete an index template using the Index Templates API
- * See Index Templates API
- * on elastic.co
- * @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 deleteTemplateAsync(
- DeleteIndexTemplateRequest request,
- RequestOptions options,
- ActionListener listener
- ) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- request,
- IndicesRequestConverters::deleteTemplate,
- options,
- AcknowledgedResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Delete an index template using the Index Templates API
- * See Index Templates API
- * on elastic.co
- *
- * @param request the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- * @throws IOException in case there is a problem sending the request or parsing back the response
- */
- public AcknowledgedResponse deleteIndexTemplate(DeleteComposableIndexTemplateRequest request, RequestOptions options)
- throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- request,
- IndicesRequestConverters::deleteIndexTemplate,
- options,
- AcknowledgedResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously delete an index template using the Index Templates API
- * See Index Templates API
- * on elastic.co
- * @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 deleteIndexTemplateAsync(
- DeleteComposableIndexTemplateRequest request,
- RequestOptions options,
- ActionListener listener
- ) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- request,
- IndicesRequestConverters::deleteIndexTemplate,
- options,
- AcknowledgedResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Synchronously calls the _reload_search_analyzers API
- *
- * @param request the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- */
- public ReloadAnalyzersResponse reloadAnalyzers(ReloadAnalyzersRequest request, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- request,
- IndicesRequestConverters::reloadAnalyzers,
- options,
- ReloadAnalyzersResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously calls the _reload_search_analyzers 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 reloadAnalyzersAsync(
- ReloadAnalyzersRequest request,
- RequestOptions options,
- ActionListener listener
- ) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- request,
- IndicesRequestConverters::reloadAnalyzers,
- options,
- ReloadAnalyzersResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-
- /**
- * Synchronously calls the delete alias api
- * @param request the request
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
- */
- public org.elasticsearch.client.core.AcknowledgedResponse deleteAlias(DeleteAliasRequest request, RequestOptions options)
- throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(
- request,
- IndicesRequestConverters::deleteAlias,
- options,
- org.elasticsearch.client.core.AcknowledgedResponse::fromXContent,
- emptySet()
- );
- }
-
- /**
- * Asynchronously calls the delete alias 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 deleteAliasAsync(
- DeleteAliasRequest request,
- RequestOptions options,
- ActionListener listener
- ) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(
- request,
- IndicesRequestConverters::deleteAlias,
- options,
- org.elasticsearch.client.core.AcknowledgedResponse::fromXContent,
- listener,
- emptySet()
- );
- }
-}
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
deleted file mode 100644
index f08a458083dc..000000000000
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesRequestConverters.java
+++ /dev/null
@@ -1,663 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-
-package org.elasticsearch.client;
-
-import org.apache.http.client.methods.HttpDelete;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.methods.HttpHead;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.client.methods.HttpPut;
-import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
-import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
-import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheRequest;
-import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
-import org.elasticsearch.action.admin.indices.flush.FlushRequest;
-import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeRequest;
-import org.elasticsearch.action.admin.indices.open.OpenIndexRequest;
-import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
-import org.elasticsearch.action.admin.indices.settings.get.GetSettingsRequest;
-import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequest;
-import org.elasticsearch.action.admin.indices.shrink.ResizeType;
-import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateRequest;
-import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryRequest;
-import org.elasticsearch.action.support.broadcast.BroadcastRequest;
-import org.elasticsearch.client.indices.AnalyzeRequest;
-import org.elasticsearch.client.indices.CloseIndexRequest;
-import org.elasticsearch.client.indices.ComposableIndexTemplateExistRequest;
-import org.elasticsearch.client.indices.CreateDataStreamRequest;
-import org.elasticsearch.client.indices.CreateIndexRequest;
-import org.elasticsearch.client.indices.DataStreamsStatsRequest;
-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.GetDataStreamRequest;
-import org.elasticsearch.client.indices.GetFieldMappingsRequest;
-import org.elasticsearch.client.indices.GetIndexRequest;
-import org.elasticsearch.client.indices.GetIndexTemplatesRequest;
-import org.elasticsearch.client.indices.GetMappingsRequest;
-import org.elasticsearch.client.indices.IndexTemplatesExistRequest;
-import org.elasticsearch.client.indices.PutComposableIndexTemplateRequest;
-import org.elasticsearch.client.indices.PutIndexTemplateRequest;
-import org.elasticsearch.client.indices.PutMappingRequest;
-import org.elasticsearch.client.indices.ReloadAnalyzersRequest;
-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;
-
-import java.io.IOException;
-import java.util.Locale;
-
-final class IndicesRequestConverters {
-
- private IndicesRequestConverters() {}
-
- static Request putDataStream(CreateDataStreamRequest createDataStreamRequest) {
- String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_data_stream")
- .addPathPart(createDataStreamRequest.getName())
- .build();
- Request request = new Request(HttpPut.METHOD_NAME, endpoint);
- return request;
- }
-
- static Request deleteDataStream(DeleteDataStreamRequest deleteDataStreamRequest) {
- String name = deleteDataStreamRequest.getName();
- String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_data_stream").addPathPart(name).build();
- Request request = new Request(HttpDelete.METHOD_NAME, endpoint);
- return request;
- }
-
- static Request getDataStreams(GetDataStreamRequest dataStreamRequest) {
- final String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_data_stream")
- .addPathPart(dataStreamRequest.getName())
- .build();
- return new Request(HttpGet.METHOD_NAME, endpoint);
- }
-
- static Request dataStreamsStats(DataStreamsStatsRequest dataStreamsStatsRequest) {
- String[] expressions = dataStreamsStatsRequest.indices() == null ? Strings.EMPTY_ARRAY : dataStreamsStatsRequest.indices();
- final String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_data_stream")
- .addCommaSeparatedPathParts(expressions)
- .addPathPartAsIs("_stats")
- .build();
- return new Request(HttpGet.METHOD_NAME, endpoint);
- }
-
- static Request deleteIndex(DeleteIndexRequest deleteIndexRequest) {
- String endpoint = RequestConverters.endpoint(deleteIndexRequest.indices());
- Request request = new Request(HttpDelete.METHOD_NAME, endpoint);
-
- RequestConverters.Params parameters = new RequestConverters.Params();
- parameters.withTimeout(deleteIndexRequest.timeout());
- parameters.withMasterTimeout(deleteIndexRequest.masterNodeTimeout());
- if (DeleteIndexRequest.DEFAULT_INDICES_OPTIONS.equals(deleteIndexRequest.indicesOptions()) == false) {
- parameters.withIndicesOptions(deleteIndexRequest.indicesOptions());
- }
- request.addParameters(parameters.asMap());
- return request;
- }
-
- static Request openIndex(OpenIndexRequest openIndexRequest) {
- String endpoint = RequestConverters.endpoint(openIndexRequest.indices(), "_open");
- Request request = new Request(HttpPost.METHOD_NAME, endpoint);
-
- RequestConverters.Params parameters = new RequestConverters.Params();
- parameters.withTimeout(openIndexRequest.timeout());
- parameters.withMasterTimeout(openIndexRequest.masterNodeTimeout());
- parameters.withWaitForActiveShards(openIndexRequest.waitForActiveShards());
- if (OpenIndexRequest.DEFAULT_INDICES_OPTIONS.equals(openIndexRequest.indicesOptions()) == false) {
- parameters.withIndicesOptions(openIndexRequest.indicesOptions());
- }
- request.addParameters(parameters.asMap());
- return request;
- }
-
- static Request closeIndex(CloseIndexRequest closeIndexRequest) {
- String endpoint = RequestConverters.endpoint(closeIndexRequest.indices(), "_close");
- Request request = new Request(HttpPost.METHOD_NAME, endpoint);
-
- RequestConverters.Params parameters = new RequestConverters.Params();
- parameters.withTimeout(closeIndexRequest.timeout());
- parameters.withMasterTimeout(closeIndexRequest.masterNodeTimeout());
- if (CloseIndexRequest.DEFAULT_INDICES_OPTIONS.equals(closeIndexRequest.indicesOptions()) == false) {
- parameters.withIndicesOptions(closeIndexRequest.indicesOptions());
- }
- parameters.withWaitForActiveShards(closeIndexRequest.waitForActiveShards());
- request.addParameters(parameters.asMap());
- return request;
- }
-
- static Request createIndex(CreateIndexRequest createIndexRequest) throws IOException {
- String endpoint = new RequestConverters.EndpointBuilder().addPathPart(createIndexRequest.index()).build();
- Request request = new Request(HttpPut.METHOD_NAME, endpoint);
-
- RequestConverters.Params parameters = new RequestConverters.Params();
- parameters.withTimeout(createIndexRequest.timeout());
- parameters.withMasterTimeout(createIndexRequest.masterNodeTimeout());
- parameters.withWaitForActiveShards(createIndexRequest.waitForActiveShards());
- request.addParameters(parameters.asMap());
- request.setEntity(RequestConverters.createEntity(createIndexRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
- return request;
- }
-
- static Request updateAliases(IndicesAliasesRequest indicesAliasesRequest) throws IOException {
- Request request = new Request(HttpPost.METHOD_NAME, "/_aliases");
-
- RequestConverters.Params parameters = new RequestConverters.Params();
- parameters.withTimeout(indicesAliasesRequest.timeout());
- parameters.withMasterTimeout(indicesAliasesRequest.masterNodeTimeout());
- request.addParameters(parameters.asMap());
- request.setEntity(RequestConverters.createEntity(indicesAliasesRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
- return request;
- }
-
- static Request putMapping(PutMappingRequest putMappingRequest) throws IOException {
- Request request = new Request(HttpPut.METHOD_NAME, RequestConverters.endpoint(putMappingRequest.indices(), "_mapping"));
-
- RequestConverters.Params parameters = new RequestConverters.Params();
- parameters.withTimeout(putMappingRequest.timeout());
- parameters.withMasterTimeout(putMappingRequest.masterNodeTimeout());
- if (PutMappingRequest.DEFAULT_INDICES_OPTIONS.equals(putMappingRequest.indicesOptions()) == false) {
- parameters.withIndicesOptions(putMappingRequest.indicesOptions());
- }
- request.addParameters(parameters.asMap());
- request.setEntity(RequestConverters.createEntity(putMappingRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
- return request;
- }
-
- static Request getMappings(GetMappingsRequest getMappingsRequest) {
- String[] indices = getMappingsRequest.indices() == null ? Strings.EMPTY_ARRAY : getMappingsRequest.indices();
-
- Request request = new Request(HttpGet.METHOD_NAME, RequestConverters.endpoint(indices, "_mapping"));
-
- RequestConverters.Params parameters = new RequestConverters.Params();
- parameters.withMasterTimeout(getMappingsRequest.masterNodeTimeout());
- parameters.withIndicesOptions(getMappingsRequest.indicesOptions());
- parameters.withLocal(getMappingsRequest.local());
- request.addParameters(parameters.asMap());
- return request;
- }
-
- static Request getFieldMapping(GetFieldMappingsRequest getFieldMappingsRequest) {
- String[] indices = getFieldMappingsRequest.indices() == null ? Strings.EMPTY_ARRAY : getFieldMappingsRequest.indices();
- String[] fields = getFieldMappingsRequest.fields() == null ? Strings.EMPTY_ARRAY : getFieldMappingsRequest.fields();
-
- String endpoint = new RequestConverters.EndpointBuilder().addCommaSeparatedPathParts(indices)
- .addPathPartAsIs("_mapping")
- .addPathPartAsIs("field")
- .addCommaSeparatedPathParts(fields)
- .build();
-
- Request request = new Request(HttpGet.METHOD_NAME, endpoint);
-
- RequestConverters.Params parameters = new RequestConverters.Params();
- parameters.withIndicesOptions(getFieldMappingsRequest.indicesOptions());
- parameters.withIncludeDefaults(getFieldMappingsRequest.includeDefaults());
- request.addParameters(parameters.asMap());
- return request;
- }
-
- static Request refresh(RefreshRequest refreshRequest) {
- String[] indices = refreshRequest.indices() == null ? Strings.EMPTY_ARRAY : refreshRequest.indices();
- Request request = new Request(HttpPost.METHOD_NAME, RequestConverters.endpoint(indices, "_refresh"));
-
- RequestConverters.Params parameters = new RequestConverters.Params();
- if (BroadcastRequest.DEFAULT_INDICES_OPTIONS.equals(refreshRequest.indicesOptions()) == false) {
- parameters.withIndicesOptions(refreshRequest.indicesOptions());
- }
- request.addParameters(parameters.asMap());
- return request;
- }
-
- static Request flush(FlushRequest flushRequest) {
- String[] indices = flushRequest.indices() == null ? Strings.EMPTY_ARRAY : flushRequest.indices();
- Request request = new Request(HttpPost.METHOD_NAME, RequestConverters.endpoint(indices, "_flush"));
-
- RequestConverters.Params parameters = new RequestConverters.Params();
- if (BroadcastRequest.DEFAULT_INDICES_OPTIONS.equals(flushRequest.indicesOptions()) == false) {
- parameters.withIndicesOptions(flushRequest.indicesOptions());
- }
- parameters.putParam("wait_if_ongoing", Boolean.toString(flushRequest.waitIfOngoing()));
- parameters.putParam("force", Boolean.toString(flushRequest.force()));
- request.addParameters(parameters.asMap());
- return request;
- }
-
- static Request forceMerge(ForceMergeRequest forceMergeRequest) {
- String[] indices = forceMergeRequest.indices() == null ? Strings.EMPTY_ARRAY : forceMergeRequest.indices();
- Request request = new Request(HttpPost.METHOD_NAME, RequestConverters.endpoint(indices, "_forcemerge"));
-
- RequestConverters.Params parameters = new RequestConverters.Params();
- if (BroadcastRequest.DEFAULT_INDICES_OPTIONS.equals(forceMergeRequest.indicesOptions()) == false) {
- parameters.withIndicesOptions(forceMergeRequest.indicesOptions());
- }
- parameters.putParam("max_num_segments", Integer.toString(forceMergeRequest.maxNumSegments()));
- parameters.putParam("only_expunge_deletes", Boolean.toString(forceMergeRequest.onlyExpungeDeletes()));
- parameters.putParam("flush", Boolean.toString(forceMergeRequest.flush()));
- request.addParameters(parameters.asMap());
- return request;
- }
-
- static Request clearCache(ClearIndicesCacheRequest clearIndicesCacheRequest) {
- String[] indices = clearIndicesCacheRequest.indices() == null ? Strings.EMPTY_ARRAY : clearIndicesCacheRequest.indices();
- Request request = new Request(HttpPost.METHOD_NAME, RequestConverters.endpoint(indices, "_cache/clear"));
-
- RequestConverters.Params parameters = new RequestConverters.Params();
- if (BroadcastRequest.DEFAULT_INDICES_OPTIONS.equals(clearIndicesCacheRequest.indicesOptions()) == false) {
- parameters.withIndicesOptions(clearIndicesCacheRequest.indicesOptions());
- }
- parameters.putParam("query", Boolean.toString(clearIndicesCacheRequest.queryCache()));
- parameters.putParam("fielddata", Boolean.toString(clearIndicesCacheRequest.fieldDataCache()));
- parameters.putParam("request", Boolean.toString(clearIndicesCacheRequest.requestCache()));
- parameters.putParam("fields", String.join(",", clearIndicesCacheRequest.fields()));
- request.addParameters(parameters.asMap());
- return request;
- }
-
- static Request existsAlias(GetAliasesRequest getAliasesRequest) {
- if ((getAliasesRequest.indices() == null || getAliasesRequest.indices().length == 0)
- && (getAliasesRequest.aliases() == null || getAliasesRequest.aliases().length == 0)) {
- throw new IllegalArgumentException("existsAlias requires at least an alias or an index");
- }
- String[] indices = getAliasesRequest.indices() == null ? Strings.EMPTY_ARRAY : getAliasesRequest.indices();
- String[] aliases = getAliasesRequest.aliases() == null ? Strings.EMPTY_ARRAY : getAliasesRequest.aliases();
-
- Request request = new Request(HttpHead.METHOD_NAME, RequestConverters.endpoint(indices, "_alias", aliases));
-
- RequestConverters.Params params = new RequestConverters.Params();
- if (GetAliasesRequest.DEFAULT_INDICES_OPTIONS.equals(getAliasesRequest.indicesOptions()) == false) {
- params.withIndicesOptions(getAliasesRequest.indicesOptions());
- }
- params.withLocal(getAliasesRequest.local());
- request.addParameters(params.asMap());
- return request;
- }
-
- static Request split(ResizeRequest resizeRequest) throws IOException {
- if (IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.exists(resizeRequest.getSettings()) == false) {
- throw new IllegalArgumentException("index.number_of_shards is required for split operations");
- }
- return resize(resizeRequest, ResizeType.SPLIT);
- }
-
- @Deprecated
- static Request split(org.elasticsearch.action.admin.indices.shrink.ResizeRequest resizeRequest) throws IOException {
- if (resizeRequest.getResizeType() != ResizeType.SPLIT) {
- throw new IllegalArgumentException("Wrong resize type [" + resizeRequest.getResizeType() + "] for indices split request");
- }
- return resize(resizeRequest);
- }
-
- static Request shrink(ResizeRequest resizeRequest) throws IOException {
- return resize(resizeRequest, ResizeType.SHRINK);
- }
-
- @Deprecated
- static Request shrink(org.elasticsearch.action.admin.indices.shrink.ResizeRequest resizeRequest) throws IOException {
- if (resizeRequest.getResizeType() != ResizeType.SHRINK) {
- throw new IllegalArgumentException("Wrong resize type [" + resizeRequest.getResizeType() + "] for indices shrink request");
- }
- return resize(resizeRequest);
- }
-
- static Request clone(ResizeRequest resizeRequest) throws IOException {
- return resize(resizeRequest, ResizeType.CLONE);
- }
-
- @Deprecated
- static Request clone(org.elasticsearch.action.admin.indices.shrink.ResizeRequest resizeRequest) throws IOException {
- if (resizeRequest.getResizeType() != ResizeType.CLONE) {
- throw new IllegalArgumentException("Wrong resize type [" + resizeRequest.getResizeType() + "] for indices clone request");
- }
- return resize(resizeRequest);
- }
-
- private static Request resize(ResizeRequest resizeRequest, ResizeType type) throws IOException {
- String endpoint = new RequestConverters.EndpointBuilder().addPathPart(resizeRequest.getSourceIndex())
- .addPathPartAsIs("_" + type.name().toLowerCase(Locale.ROOT))
- .addPathPart(resizeRequest.getTargetIndex())
- .build();
- Request request = new Request(HttpPut.METHOD_NAME, endpoint);
-
- RequestConverters.Params params = new RequestConverters.Params();
- params.withTimeout(resizeRequest.timeout());
- params.withMasterTimeout(resizeRequest.masterNodeTimeout());
- params.withWaitForActiveShards(resizeRequest.getWaitForActiveShards());
- request.addParameters(params.asMap());
- request.setEntity(RequestConverters.createEntity(resizeRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
- return request;
- }
-
- @Deprecated
- private static Request resize(org.elasticsearch.action.admin.indices.shrink.ResizeRequest resizeRequest) throws IOException {
- String endpoint = new RequestConverters.EndpointBuilder().addPathPart(resizeRequest.getSourceIndex())
- .addPathPartAsIs("_" + resizeRequest.getResizeType().name().toLowerCase(Locale.ROOT))
- .addPathPart(resizeRequest.getTargetIndexRequest().index())
- .build();
- Request request = new Request(HttpPut.METHOD_NAME, endpoint);
-
- RequestConverters.Params params = new RequestConverters.Params();
- params.withTimeout(resizeRequest.timeout());
- params.withMasterTimeout(resizeRequest.masterNodeTimeout());
- params.withWaitForActiveShards(resizeRequest.getTargetIndexRequest().waitForActiveShards());
- request.addParameters(params.asMap());
- request.setEntity(RequestConverters.createEntity(resizeRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
- return request;
- }
-
- static Request rollover(RolloverRequest rolloverRequest) throws IOException {
- String endpoint = new RequestConverters.EndpointBuilder().addPathPart(rolloverRequest.getAlias())
- .addPathPartAsIs("_rollover")
- .addPathPart(rolloverRequest.getNewIndexName())
- .build();
- Request request = new Request(HttpPost.METHOD_NAME, endpoint);
-
- RequestConverters.Params params = new RequestConverters.Params();
- params.withTimeout(rolloverRequest.timeout());
- params.withMasterTimeout(rolloverRequest.masterNodeTimeout());
- params.withWaitForActiveShards(rolloverRequest.getCreateIndexRequest().waitForActiveShards());
- if (rolloverRequest.isDryRun()) {
- params.putParam("dry_run", Boolean.TRUE.toString());
- }
- request.addParameters(params.asMap());
- request.setEntity(RequestConverters.createEntity(rolloverRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
- return request;
- }
-
- static Request getSettings(GetSettingsRequest getSettingsRequest) {
- String[] indices = getSettingsRequest.indices() == null ? Strings.EMPTY_ARRAY : getSettingsRequest.indices();
- String[] names = getSettingsRequest.names() == null ? Strings.EMPTY_ARRAY : getSettingsRequest.names();
-
- String endpoint = RequestConverters.endpoint(indices, "_settings", names);
- Request request = new Request(HttpGet.METHOD_NAME, endpoint);
-
- RequestConverters.Params params = new RequestConverters.Params();
- if (GetSettingsRequest.DEFAULT_INDICES_OPTIONS.equals(getSettingsRequest.indicesOptions()) == false) {
- params.withIndicesOptions(getSettingsRequest.indicesOptions());
- }
- params.withLocal(getSettingsRequest.local());
- params.withIncludeDefaults(getSettingsRequest.includeDefaults());
- params.withMasterTimeout(getSettingsRequest.masterNodeTimeout());
- request.addParameters(params.asMap());
- return request;
- }
-
- static Request getIndex(GetIndexRequest getIndexRequest) {
- String[] indices = getIndexRequest.indices() == null ? Strings.EMPTY_ARRAY : getIndexRequest.indices();
-
- String endpoint = RequestConverters.endpoint(indices);
- Request request = new Request(HttpGet.METHOD_NAME, endpoint);
-
- RequestConverters.Params params = new RequestConverters.Params();
- if (GetIndexRequest.DEFAULT_INDICES_OPTIONS.equals(getIndexRequest.indicesOptions()) == false) {
- params.withIndicesOptions(getIndexRequest.indicesOptions());
- }
- params.withLocal(getIndexRequest.local());
- params.withIncludeDefaults(getIndexRequest.includeDefaults());
- params.withHuman(getIndexRequest.humanReadable());
- params.withMasterTimeout(getIndexRequest.masterNodeTimeout());
- request.addParameters(params.asMap());
- return request;
- }
-
- static Request indicesExist(GetIndexRequest getIndexRequest) {
- if (getIndexRequest.indices() == null || getIndexRequest.indices().length == 0) {
- throw new IllegalArgumentException("indices are mandatory");
- }
- String endpoint = RequestConverters.endpoint(getIndexRequest.indices(), "");
- Request request = new Request(HttpHead.METHOD_NAME, endpoint);
-
- RequestConverters.Params params = new RequestConverters.Params();
- params.withLocal(getIndexRequest.local());
- params.withHuman(getIndexRequest.humanReadable());
- if (GetIndexRequest.DEFAULT_INDICES_OPTIONS.equals(getIndexRequest.indicesOptions()) == false) {
- params.withIndicesOptions(getIndexRequest.indicesOptions());
- }
- params.withIncludeDefaults(getIndexRequest.includeDefaults());
- request.addParameters(params.asMap());
- return request;
- }
-
- static Request indexPutSettings(UpdateSettingsRequest updateSettingsRequest) throws IOException {
- String[] indices = updateSettingsRequest.indices() == null ? Strings.EMPTY_ARRAY : updateSettingsRequest.indices();
- Request request = new Request(HttpPut.METHOD_NAME, RequestConverters.endpoint(indices, "_settings"));
-
- RequestConverters.Params parameters = new RequestConverters.Params();
- parameters.withTimeout(updateSettingsRequest.timeout());
- parameters.withMasterTimeout(updateSettingsRequest.masterNodeTimeout());
- if (UpdateSettingsRequest.DEFAULT_INDICES_OPTIONS.equals(updateSettingsRequest.indicesOptions()) == false) {
- parameters.withIndicesOptions(updateSettingsRequest.indicesOptions());
- }
- parameters.withPreserveExisting(updateSettingsRequest.isPreserveExisting());
- request.addParameters(parameters.asMap());
- request.setEntity(RequestConverters.createEntity(updateSettingsRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
- return request;
- }
-
- static Request putTemplate(PutIndexTemplateRequest putIndexTemplateRequest) throws IOException {
- String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_template")
- .addPathPart(putIndexTemplateRequest.name())
- .build();
- Request request = new Request(HttpPut.METHOD_NAME, endpoint);
- RequestConverters.Params params = new RequestConverters.Params();
- params.withMasterTimeout(putIndexTemplateRequest.masterNodeTimeout());
- if (putIndexTemplateRequest.create()) {
- params.putParam("create", Boolean.TRUE.toString());
- }
- if (Strings.hasText(putIndexTemplateRequest.cause())) {
- params.putParam("cause", putIndexTemplateRequest.cause());
- }
- request.addParameters(params.asMap());
- request.setEntity(RequestConverters.createEntity(putIndexTemplateRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
- return request;
- }
-
- static Request putIndexTemplate(PutComposableIndexTemplateRequest putIndexTemplateRequest) throws IOException {
- String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_index_template")
- .addPathPart(putIndexTemplateRequest.name())
- .build();
- Request request = new Request(HttpPut.METHOD_NAME, endpoint);
- RequestConverters.Params params = new RequestConverters.Params();
- params.withMasterTimeout(putIndexTemplateRequest.masterNodeTimeout());
- if (putIndexTemplateRequest.create()) {
- params.putParam("create", Boolean.TRUE.toString());
- }
- if (Strings.hasText(putIndexTemplateRequest.cause())) {
- params.putParam("cause", putIndexTemplateRequest.cause());
- }
- request.addParameters(params.asMap());
- request.setEntity(RequestConverters.createEntity(putIndexTemplateRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
- return request;
- }
-
- static Request simulateIndexTemplate(SimulateIndexTemplateRequest simulateIndexTemplateRequest) throws IOException {
- String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_index_template", "_simulate_index")
- .addPathPart(simulateIndexTemplateRequest.indexName())
- .build();
- Request request = new Request(HttpPost.METHOD_NAME, endpoint);
- RequestConverters.Params params = new RequestConverters.Params();
- params.withMasterTimeout(simulateIndexTemplateRequest.masterNodeTimeout());
- PutComposableIndexTemplateRequest putComposableIndexTemplateRequest = simulateIndexTemplateRequest.indexTemplateV2Request();
- if (putComposableIndexTemplateRequest != null) {
- if (putComposableIndexTemplateRequest.create()) {
- params.putParam("create", Boolean.TRUE.toString());
- }
- if (Strings.hasText(putComposableIndexTemplateRequest.cause())) {
- params.putParam("cause", putComposableIndexTemplateRequest.cause());
- }
- request.setEntity(
- RequestConverters.createEntity(putComposableIndexTemplateRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE)
- );
- }
- request.addParameters(params.asMap());
- return request;
- }
-
- static Request validateQuery(ValidateQueryRequest validateQueryRequest) throws IOException {
- String[] indices = validateQueryRequest.indices() == null ? Strings.EMPTY_ARRAY : validateQueryRequest.indices();
- String endpoint = RequestConverters.endpoint(indices, "_validate/query");
- Request request = new Request(HttpGet.METHOD_NAME, endpoint);
- RequestConverters.Params params = new RequestConverters.Params();
- if (ValidateQueryRequest.DEFAULT_INDICES_OPTIONS.equals(validateQueryRequest.indicesOptions()) == false) {
- params.withIndicesOptions(validateQueryRequest.indicesOptions());
- }
- params.putParam("explain", Boolean.toString(validateQueryRequest.explain()));
- params.putParam("all_shards", Boolean.toString(validateQueryRequest.allShards()));
- params.putParam("rewrite", Boolean.toString(validateQueryRequest.rewrite()));
- request.addParameters(params.asMap());
- request.setEntity(RequestConverters.createEntity(validateQueryRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
- return request;
- }
-
- static Request getAlias(GetAliasesRequest getAliasesRequest) {
- String[] indices = getAliasesRequest.indices() == null ? Strings.EMPTY_ARRAY : getAliasesRequest.indices();
- String[] aliases = getAliasesRequest.aliases() == null ? Strings.EMPTY_ARRAY : getAliasesRequest.aliases();
- String endpoint = RequestConverters.endpoint(indices, "_alias", aliases);
- Request request = new Request(HttpGet.METHOD_NAME, endpoint);
- RequestConverters.Params params = new RequestConverters.Params();
- if (GetAliasesRequest.DEFAULT_INDICES_OPTIONS.equals(getAliasesRequest.indicesOptions()) == false) {
- params.withIndicesOptions(getAliasesRequest.indicesOptions());
- }
- params.withLocal(getAliasesRequest.local());
- request.addParameters(params.asMap());
- return request;
- }
-
- static Request getTemplates(GetIndexTemplatesRequest getIndexTemplatesRequest) {
- final String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_template")
- .addCommaSeparatedPathParts(getIndexTemplatesRequest.names())
- .build();
- final Request request = new Request(HttpGet.METHOD_NAME, endpoint);
- final RequestConverters.Params params = new RequestConverters.Params();
- params.withLocal(getIndexTemplatesRequest.isLocal());
- params.withMasterTimeout(getIndexTemplatesRequest.getMasterNodeTimeout());
- request.addParameters(params.asMap());
- return request;
- }
-
- static Request getIndexTemplates(GetComposableIndexTemplateRequest getIndexTemplatesRequest) {
- final String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_index_template")
- .addPathPart(getIndexTemplatesRequest.name())
- .build();
- final Request request = new Request(HttpGet.METHOD_NAME, endpoint);
- final RequestConverters.Params params = new RequestConverters.Params();
- params.withLocal(getIndexTemplatesRequest.isLocal());
- params.withMasterTimeout(getIndexTemplatesRequest.getMasterNodeTimeout());
- request.addParameters(params.asMap());
- return request;
- }
-
- static Request templatesExist(IndexTemplatesExistRequest indexTemplatesExistRequest) {
- final String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_template")
- .addCommaSeparatedPathParts(indexTemplatesExistRequest.names())
- .build();
- final Request request = new Request(HttpHead.METHOD_NAME, endpoint);
- final RequestConverters.Params params = new RequestConverters.Params();
- params.withLocal(indexTemplatesExistRequest.isLocal());
- params.withMasterTimeout(indexTemplatesExistRequest.getMasterNodeTimeout());
- request.addParameters(params.asMap());
- return request;
- }
-
- static Request templatesExist(ComposableIndexTemplateExistRequest indexTemplatesExistRequest) {
- final String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_index_template")
- .addPathPart(indexTemplatesExistRequest.name())
- .build();
- final Request request = new Request(HttpHead.METHOD_NAME, endpoint);
- final RequestConverters.Params params = new RequestConverters.Params();
- params.withLocal(indexTemplatesExistRequest.isLocal());
- params.withMasterTimeout(indexTemplatesExistRequest.getMasterNodeTimeout());
- request.addParameters(params.asMap());
- return request;
- }
-
- static Request analyze(AnalyzeRequest request) throws IOException {
- RequestConverters.EndpointBuilder builder = new RequestConverters.EndpointBuilder();
- String index = request.index();
- if (index != null) {
- builder.addPathPart(index);
- }
- builder.addPathPartAsIs("_analyze");
- Request req = new Request(HttpGet.METHOD_NAME, builder.build());
- req.setEntity(RequestConverters.createEntity(request, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
- 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();
- Request request = new Request(HttpDelete.METHOD_NAME, endpoint);
- RequestConverters.Params params = new RequestConverters.Params();
- params.withMasterTimeout(deleteIndexTemplateRequest.masterNodeTimeout());
- request.addParameters(params.asMap());
- return request;
- }
-
- static Request deleteIndexTemplate(DeleteComposableIndexTemplateRequest deleteIndexTemplateRequest) {
- String name = deleteIndexTemplateRequest.getName();
- String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_index_template").addPathPart(name).build();
- Request request = new Request(HttpDelete.METHOD_NAME, endpoint);
- RequestConverters.Params params = new RequestConverters.Params();
- params.withMasterTimeout(deleteIndexTemplateRequest.masterNodeTimeout());
- request.addParameters(params.asMap());
- return request;
- }
-
- static Request reloadAnalyzers(ReloadAnalyzersRequest reloadAnalyzersRequest) {
- String endpoint = RequestConverters.endpoint(reloadAnalyzersRequest.getIndices(), "_reload_search_analyzers");
- Request request = new Request(HttpPost.METHOD_NAME, endpoint);
- RequestConverters.Params parameters = new RequestConverters.Params();
- if (ReloadAnalyzersRequest.DEFAULT_INDICES_OPTIONS.equals(reloadAnalyzersRequest.indicesOptions()) == false) {
- parameters.withIndicesOptions(reloadAnalyzersRequest.indicesOptions());
- }
- request.addParameters(parameters.asMap());
- return request;
- }
-
- static Request deleteAlias(DeleteAliasRequest deleteAliasRequest) {
- String endpoint = new RequestConverters.EndpointBuilder().addPathPart(deleteAliasRequest.getIndex())
- .addPathPartAsIs("_alias")
- .addPathPart(deleteAliasRequest.getAlias())
- .build();
- Request request = new Request(HttpDelete.METHOD_NAME, endpoint);
- RequestConverters.Params parameters = new RequestConverters.Params();
- parameters.withTimeout(deleteAliasRequest.timeout());
- parameters.withMasterTimeout(deleteAliasRequest.masterNodeTimeout());
- request.addParameters(parameters.asMap());
- return request;
- }
-}
diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/RequestConverters.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/RequestConverters.java
index fdd6bbaebcdd..b90304f167be 100644
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/RequestConverters.java
+++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/RequestConverters.java
@@ -43,7 +43,6 @@ import org.elasticsearch.client.core.CountRequest;
import org.elasticsearch.client.core.GetSourceRequest;
import org.elasticsearch.client.core.MultiTermVectorsRequest;
import org.elasticsearch.client.core.TermVectorsRequest;
-import org.elasticsearch.client.indices.AnalyzeRequest;
import org.elasticsearch.client.internal.Requests;
import org.elasticsearch.client.security.RefreshPolicy;
import org.elasticsearch.client.tasks.TaskId;
@@ -725,18 +724,6 @@ final class RequestConverters {
return request;
}
- static Request analyze(AnalyzeRequest request) throws IOException {
- EndpointBuilder builder = new EndpointBuilder();
- String index = request.index();
- if (index != null) {
- builder.addPathPart(index);
- }
- builder.addPathPartAsIs("_analyze");
- Request req = new Request(HttpGet.METHOD_NAME, builder.build());
- req.setEntity(createEntity(request, REQUEST_BODY_CONTENT_TYPE));
- return req;
- }
-
static Request termVectors(TermVectorsRequest tvrequest) throws IOException {
String endpoint;
if (tvrequest.getType() != null) {
diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/RestHighLevelClient.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/RestHighLevelClient.java
index 079e6b894c13..35a2319dfec0 100644
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/RestHighLevelClient.java
+++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/RestHighLevelClient.java
@@ -273,7 +273,6 @@ public class RestHighLevelClient implements Closeable {
/** Do not access directly but through getVersionValidationFuture() */
private volatile ListenableFuture> versionValidationFuture;
- private final IndicesClient indicesClient = new IndicesClient(this);
private final SnapshotClient snapshotClient = new SnapshotClient(this);
private final SecurityClient securityClient = new SecurityClient(this);
private final TransformClient transformClient = new TransformClient(this);
@@ -349,15 +348,6 @@ public class RestHighLevelClient implements Closeable {
doClose.accept(client);
}
- /**
- * Provides an {@link IndicesClient} which can be used to access the Indices API.
- *
- * See Indices API on elastic.co
- */
- public final IndicesClient indices() {
- return indicesClient;
- }
-
/**
* Provides a {@link SnapshotClient} which can be used to access the Snapshot API.
*
diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/AnalyzeRequest.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/AnalyzeRequest.java
deleted file mode 100644
index a6b8c16016f8..000000000000
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/AnalyzeRequest.java
+++ /dev/null
@@ -1,329 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-
-package org.elasticsearch.client.indices;
-
-import org.elasticsearch.client.Validatable;
-import org.elasticsearch.common.Strings;
-import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.xcontent.ToXContentFragment;
-import org.elasticsearch.xcontent.ToXContentObject;
-import org.elasticsearch.xcontent.XContentBuilder;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-
-/**
- * A request to analyze text
- */
-public class AnalyzeRequest implements Validatable, ToXContentObject {
-
- private String index;
-
- private String[] text;
-
- private String analyzer;
-
- private NameOrDefinition tokenizer;
-
- private final List tokenFilters = new ArrayList<>();
-
- private final List charFilters = new ArrayList<>();
-
- private String field;
-
- private boolean explain = false;
-
- private String[] attributes = Strings.EMPTY_ARRAY;
-
- private String normalizer;
-
- /**
- * Analyzes text using a global analyzer
- */
- public static AnalyzeRequest withGlobalAnalyzer(String analyzer, String... text) {
- return new AnalyzeRequest(null, analyzer, null, null, text);
- }
-
- /**
- * Analyzes text using a custom analyzer built from global components
- */
- public static CustomAnalyzerBuilder buildCustomAnalyzer(String tokenizer) {
- return new CustomAnalyzerBuilder(null, new NameOrDefinition(tokenizer));
- }
-
- /**
- * Analyzes text using a custom analyzer built from global components
- */
- public static CustomAnalyzerBuilder buildCustomAnalyzer(Map tokenizerSettings) {
- return new CustomAnalyzerBuilder(null, new NameOrDefinition(tokenizerSettings));
- }
-
- /**
- * Analyzes text using a custom analyzer built from components defined on an index
- */
- public static CustomAnalyzerBuilder buildCustomAnalyzer(String index, String tokenizer) {
- return new CustomAnalyzerBuilder(index, new NameOrDefinition(tokenizer));
- }
-
- /**
- * Analyzes text using a custom analyzer built from components defined on an index
- */
- public static CustomAnalyzerBuilder buildCustomAnalyzer(String index, Map tokenizerSettings) {
- return new CustomAnalyzerBuilder(index, new NameOrDefinition(tokenizerSettings));
- }
-
- /**
- * Analyzes text using a named analyzer on an index
- */
- public static AnalyzeRequest withIndexAnalyzer(String index, String analyzer, String... text) {
- return new AnalyzeRequest(index, analyzer, null, null, text);
- }
-
- /**
- * Analyzes text using the analyzer defined on a specific field within an index
- */
- public static AnalyzeRequest withField(String index, String field, String... text) {
- return new AnalyzeRequest(index, null, null, field, text);
- }
-
- /**
- * Analyzes text using a named normalizer on an index
- */
- public static AnalyzeRequest withNormalizer(String index, String normalizer, String... text) {
- return new AnalyzeRequest(index, null, normalizer, null, text);
- }
-
- /**
- * Analyzes text using a custom normalizer built from global components
- */
- public static CustomAnalyzerBuilder buildCustomNormalizer() {
- return new CustomAnalyzerBuilder(null, null);
- }
-
- /**
- * Analyzes text using a custom normalizer built from components defined on an index
- */
- public static CustomAnalyzerBuilder buildCustomNormalizer(String index) {
- return new CustomAnalyzerBuilder(index, null);
- }
-
- /**
- * Helper class to build custom analyzer definitions
- */
- public static class CustomAnalyzerBuilder {
-
- final NameOrDefinition tokenizer;
- final String index;
- List charFilters = new ArrayList<>();
- List tokenFilters = new ArrayList<>();
-
- CustomAnalyzerBuilder(String index, NameOrDefinition tokenizer) {
- this.tokenizer = tokenizer;
- this.index = index;
- }
-
- public CustomAnalyzerBuilder addCharFilter(String name) {
- charFilters.add(new NameOrDefinition(name));
- return this;
- }
-
- public CustomAnalyzerBuilder addCharFilter(Map settings) {
- charFilters.add(new NameOrDefinition(settings));
- return this;
- }
-
- public CustomAnalyzerBuilder addTokenFilter(String name) {
- tokenFilters.add(new NameOrDefinition(name));
- return this;
- }
-
- public CustomAnalyzerBuilder addTokenFilter(Map settings) {
- tokenFilters.add(new NameOrDefinition(settings));
- return this;
- }
-
- public AnalyzeRequest build(String... text) {
- return new AnalyzeRequest(index, tokenizer, charFilters, tokenFilters, text);
- }
- }
-
- private AnalyzeRequest(String index, String analyzer, String normalizer, String field, String... text) {
- this.index = index;
- this.analyzer = analyzer;
- this.normalizer = normalizer;
- this.field = field;
- this.text = text;
- }
-
- private AnalyzeRequest(
- String index,
- NameOrDefinition tokenizer,
- List charFilters,
- List tokenFilters,
- String... text
- ) {
- this.index = index;
- this.analyzer = null;
- this.normalizer = null;
- this.field = null;
- this.tokenizer = tokenizer;
- this.charFilters.addAll(charFilters);
- this.tokenFilters.addAll(tokenFilters);
- this.text = text;
- }
-
- static class NameOrDefinition implements ToXContentFragment {
- // exactly one of these two members is not null
- public final String name;
- public final Settings definition;
-
- NameOrDefinition(String name) {
- this.name = Objects.requireNonNull(name);
- this.definition = null;
- }
-
- NameOrDefinition(Settings settings) {
- this.name = null;
- this.definition = Objects.requireNonNull(settings);
- }
-
- NameOrDefinition(Map definition) {
- this.name = null;
- Objects.requireNonNull(definition);
- this.definition = Settings.builder().loadFromMap(definition).build();
- }
-
- @Override
- public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
- if (definition == null) {
- return builder.value(name);
- }
- builder.startObject();
- definition.toXContent(builder, params);
- builder.endObject();
- return builder;
- }
-
- }
-
- /**
- * Returns the index that the request should be executed against, or {@code null} if
- * no index is specified
- */
- public String index() {
- return this.index;
- }
-
- /**
- * Returns the text to be analyzed
- */
- public String[] text() {
- return this.text;
- }
-
- /**
- * Returns the named analyzer used for analysis, if defined
- */
- public String analyzer() {
- return this.analyzer;
- }
-
- /**
- * Returns the named tokenizer used for analysis, if defined
- */
- public String normalizer() {
- return this.normalizer;
- }
-
- /**
- * Returns a custom Tokenizer used for analysis, if defined
- */
- public NameOrDefinition tokenizer() {
- return this.tokenizer;
- }
-
- /**
- * Returns the custom token filters used for analysis, if defined
- */
- public List tokenFilters() {
- return this.tokenFilters;
- }
-
- /**
- * Returns the custom character filters used for analysis, if defined
- */
- public List charFilters() {
- return this.charFilters;
- }
-
- /**
- * Returns the field to take an Analyzer from, if defined
- */
- public String field() {
- return this.field;
- }
-
- /**
- * Set whether or not detailed explanations of analysis should be returned
- */
- public AnalyzeRequest explain(boolean explain) {
- this.explain = explain;
- return this;
- }
-
- public boolean explain() {
- return this.explain;
- }
-
- public AnalyzeRequest attributes(String... attributes) {
- if (attributes == null) {
- throw new IllegalArgumentException("attributes must not be null");
- }
- this.attributes = attributes;
- return this;
- }
-
- public String[] attributes() {
- return this.attributes;
- }
-
- @Override
- public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
- builder.startObject();
- builder.field("text", text);
- if (Strings.isNullOrEmpty(analyzer) == false) {
- builder.field("analyzer", analyzer);
- }
- if (tokenizer != null) {
- builder.field("tokenizer", tokenizer);
- }
- if (tokenFilters.size() > 0) {
- builder.field("filter", tokenFilters);
- }
- if (charFilters.size() > 0) {
- builder.field("char_filter", charFilters);
- }
- if (Strings.isNullOrEmpty(field) == false) {
- builder.field("field", field);
- }
- if (explain) {
- builder.field("explain", true);
- }
- if (attributes.length > 0) {
- builder.field("attributes", attributes);
- }
- if (Strings.isNullOrEmpty(normalizer) == false) {
- builder.field("normalizer", normalizer);
- }
- return builder.endObject();
- }
-}
diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/AnalyzeResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/AnalyzeResponse.java
deleted file mode 100644
index 101550f9ff44..000000000000
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/AnalyzeResponse.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-
-package org.elasticsearch.client.indices;
-
-import org.elasticsearch.xcontent.ConstructingObjectParser;
-import org.elasticsearch.xcontent.ObjectParser;
-import org.elasticsearch.xcontent.ParseField;
-import org.elasticsearch.xcontent.XContentParser;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-
-import static org.elasticsearch.xcontent.ConstructingObjectParser.optionalConstructorArg;
-
-public class AnalyzeResponse {
-
- private static final String TOKENS = "tokens";
- private static final String DETAIL = "detail";
-
- public static class AnalyzeToken {
- private String term;
- private int startOffset;
- private int endOffset;
- private int position;
- private int positionLength = 1;
- private String type;
- private final Map attributes = new HashMap<>();
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- AnalyzeResponse.AnalyzeToken that = (AnalyzeResponse.AnalyzeToken) o;
- return startOffset == that.startOffset
- && endOffset == that.endOffset
- && position == that.position
- && positionLength == that.positionLength
- && Objects.equals(term, that.term)
- && Objects.equals(attributes, that.attributes)
- && Objects.equals(type, that.type);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(term, startOffset, endOffset, position, positionLength, attributes, type);
- }
-
- public String getTerm() {
- return this.term;
- }
-
- private void setTerm(String term) {
- this.term = term;
- }
-
- public int getStartOffset() {
- return this.startOffset;
- }
-
- private void setStartOffset(int startOffset) {
- this.startOffset = startOffset;
- }
-
- public int getEndOffset() {
- return this.endOffset;
- }
-
- private void setEndOffset(int endOffset) {
- this.endOffset = endOffset;
- }
-
- public int getPosition() {
- return this.position;
- }
-
- private void setPosition(int position) {
- this.position = position;
- }
-
- public int getPositionLength() {
- return this.positionLength;
- }
-
- private void setPositionLength(int positionLength) {
- this.positionLength = positionLength;
- }
-
- public String getType() {
- return this.type;
- }
-
- private void setType(String type) {
- this.type = type;
- }
-
- public Map getAttributes() {
- return this.attributes;
- }
-
- private void setAttribute(String key, Object value) {
- this.attributes.put(key, value);
- }
-
- private static final ObjectParser PARSER = new ObjectParser<>(
- "analyze_token",
- AnalyzeToken::setAttribute,
- AnalyzeToken::new
- );
- static {
- PARSER.declareString(AnalyzeToken::setTerm, new ParseField("token"));
- PARSER.declareString(AnalyzeToken::setType, new ParseField("type"));
- PARSER.declareInt(AnalyzeToken::setPosition, new ParseField("position"));
- PARSER.declareInt(AnalyzeToken::setStartOffset, new ParseField("start_offset"));
- PARSER.declareInt(AnalyzeToken::setEndOffset, new ParseField("end_offset"));
- PARSER.declareInt(AnalyzeToken::setPositionLength, new ParseField("positionLength"));
- }
-
- public static AnalyzeToken fromXContent(XContentParser parser) throws IOException {
- return PARSER.parse(parser, null);
- }
- }
-
- private final DetailAnalyzeResponse detail;
- private final List tokens;
-
- private AnalyzeResponse(List tokens, DetailAnalyzeResponse detail) {
- this.tokens = tokens;
- this.detail = detail;
- }
-
- public List getTokens() {
- return this.tokens;
- }
-
- public DetailAnalyzeResponse detail() {
- return this.detail;
- }
-
- @SuppressWarnings("unchecked")
- private static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>(
- "analyze_response",
- true,
- args -> new AnalyzeResponse((List) args[0], (DetailAnalyzeResponse) args[1])
- );
-
- static {
- PARSER.declareObjectArray(optionalConstructorArg(), AnalyzeToken.PARSER, new ParseField(TOKENS));
- PARSER.declareObject(optionalConstructorArg(), DetailAnalyzeResponse.PARSER, new ParseField(DETAIL));
- }
-
- public static AnalyzeResponse fromXContent(XContentParser parser) throws IOException {
- return PARSER.parse(parser, null);
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- AnalyzeResponse that = (AnalyzeResponse) o;
- return Objects.equals(detail, that.detail) && Objects.equals(tokens, that.tokens);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(detail, tokens);
- }
-
-}
diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/CloseIndexRequest.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/CloseIndexRequest.java
deleted file mode 100644
index 4a889c3b9aa1..000000000000
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/CloseIndexRequest.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-
-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 org.elasticsearch.client.Validatable;
-import org.elasticsearch.client.ValidationException;
-
-import java.util.Optional;
-
-/**
- * A request to close an index.
- */
-public class CloseIndexRequest extends TimedRequest implements Validatable {
-
- public static final IndicesOptions DEFAULT_INDICES_OPTIONS = IndicesOptions.strictExpandOpen();
-
- private String[] indices;
- private IndicesOptions indicesOptions = DEFAULT_INDICES_OPTIONS;
- private ActiveShardCount waitForActiveShards = ActiveShardCount.DEFAULT;
-
- /**
- * Creates a new close index request
- *
- * @param indices the indices to close
- */
- public CloseIndexRequest(String... indices) {
- this.indices = indices;
- }
-
- /**
- * Returns the indices to close
- */
- public String[] indices() {
- 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 CloseIndexRequest indicesOptions(IndicesOptions indicesOptions) {
- this.indicesOptions = indicesOptions;
- return this;
- }
-
- /**
- * Returns the wait for active shard count or null if the default should be used
- */
- public ActiveShardCount waitForActiveShards() {
- 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 CloseIndexRequest waitForActiveShards(ActiveShardCount waitForActiveShards) {
- this.waitForActiveShards = waitForActiveShards;
- return this;
- }
-
- @Override
- public Optional validate() {
- if (indices == null || indices.length == 0) {
- ValidationException validationException = new ValidationException();
- validationException.addValidationError("index is missing");
- return Optional.of(validationException);
- } else {
- return Optional.empty();
- }
- }
-}
diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/CloseIndexResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/CloseIndexResponse.java
deleted file mode 100644
index 8c9719fbe3df..000000000000
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/CloseIndexResponse.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-package org.elasticsearch.client.indices;
-
-import org.elasticsearch.ElasticsearchException;
-import org.elasticsearch.action.support.DefaultShardOperationFailedException;
-import org.elasticsearch.action.support.master.ShardsAcknowledgedResponse;
-import org.elasticsearch.common.xcontent.XContentParserUtils;
-import org.elasticsearch.core.Nullable;
-import org.elasticsearch.xcontent.ConstructingObjectParser;
-import org.elasticsearch.xcontent.ParseField;
-import org.elasticsearch.xcontent.XContentParser;
-
-import java.util.List;
-import java.util.Objects;
-
-import static java.util.Collections.emptyList;
-import static java.util.Collections.unmodifiableList;
-import static org.elasticsearch.xcontent.ConstructingObjectParser.optionalConstructorArg;
-import static org.elasticsearch.xcontent.ObjectParser.ValueType;
-
-public class CloseIndexResponse extends ShardsAcknowledgedResponse {
-
- @SuppressWarnings("unchecked")
- private static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>(
- "close_index_response",
- true,
- args -> {
- boolean acknowledged = (boolean) args[0];
- boolean shardsAcknowledged = args[1] != null ? (boolean) args[1] : acknowledged;
- List indices = args[2] != null ? (List) args[2] : emptyList();
- return new CloseIndexResponse(acknowledged, shardsAcknowledged, indices);
- }
- );
-
- static {
- declareAcknowledgedField(PARSER);
- PARSER.declareField(optionalConstructorArg(), (parser, context) -> parser.booleanValue(), SHARDS_ACKNOWLEDGED, ValueType.BOOLEAN);
- PARSER.declareNamedObjects(optionalConstructorArg(), (p, c, name) -> IndexResult.fromXContent(p, name), new ParseField("indices"));
- }
-
- private final List indices;
-
- public CloseIndexResponse(final boolean acknowledged, final boolean shardsAcknowledged, final List indices) {
- super(acknowledged, shardsAcknowledged);
- this.indices = unmodifiableList(Objects.requireNonNull(indices));
- }
-
- public List getIndices() {
- return indices;
- }
-
- public static CloseIndexResponse fromXContent(final XContentParser parser) {
- return PARSER.apply(parser, null);
- }
-
- public static class IndexResult {
-
- @SuppressWarnings("unchecked")
- private static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>(
- "index_result",
- true,
- (args, index) -> {
- Exception exception = (Exception) args[1];
- if (exception != null) {
- assert (boolean) args[0] == false;
- return new IndexResult(index, exception);
- }
- ShardResult[] shardResults = args[2] != null ? ((List) args[2]).toArray(new ShardResult[0]) : null;
- if (shardResults != null) {
- assert (boolean) args[0] == false;
- return new IndexResult(index, shardResults);
- }
- assert (boolean) args[0];
- return new IndexResult(index);
- }
- );
- static {
- PARSER.declareBoolean(optionalConstructorArg(), new ParseField("closed"));
- PARSER.declareObject(optionalConstructorArg(), (p, c) -> {
- XContentParserUtils.ensureExpectedToken(XContentParser.Token.START_OBJECT, p.currentToken(), p);
- XContentParserUtils.ensureExpectedToken(XContentParser.Token.FIELD_NAME, p.nextToken(), p);
- Exception e = ElasticsearchException.failureFromXContent(p);
- XContentParserUtils.ensureExpectedToken(XContentParser.Token.END_OBJECT, p.nextToken(), p);
- return e;
- }, new ParseField("exception"));
- PARSER.declareNamedObjects(
- optionalConstructorArg(),
- (p, c, id) -> ShardResult.fromXContent(p, id),
- new ParseField("failedShards")
- );
- }
-
- private final String index;
- private final @Nullable Exception exception;
- private final @Nullable ShardResult[] shards;
-
- IndexResult(final String index) {
- this(index, null, null);
- }
-
- IndexResult(final String index, final Exception failure) {
- this(index, Objects.requireNonNull(failure), null);
- }
-
- IndexResult(final String index, final ShardResult[] shards) {
- this(index, null, Objects.requireNonNull(shards));
- }
-
- private IndexResult(final String index, @Nullable final Exception exception, @Nullable final ShardResult[] shards) {
- this.index = Objects.requireNonNull(index);
- this.exception = exception;
- this.shards = shards;
- }
-
- public String getIndex() {
- return index;
- }
-
- public @Nullable Exception getException() {
- return exception;
- }
-
- public @Nullable ShardResult[] getShards() {
- return shards;
- }
-
- public boolean hasFailures() {
- if (exception != null) {
- return true;
- }
- if (shards != null) {
- for (ShardResult shard : shards) {
- if (shard.hasFailures()) {
- return true;
- }
- }
- }
- return false;
- }
-
- static IndexResult fromXContent(final XContentParser parser, final String name) {
- return PARSER.apply(parser, name);
- }
- }
-
- public static class ShardResult {
-
- @SuppressWarnings("unchecked")
- private static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>(
- "shard_result",
- true,
- (arg, id) -> {
- Failure[] failures = arg[0] != null ? ((List) arg[0]).toArray(new Failure[0]) : new Failure[0];
- return new ShardResult(Integer.parseInt(id), failures);
- }
- );
-
- static {
- PARSER.declareObjectArray(optionalConstructorArg(), (p, c) -> Failure.PARSER.apply(p, null), new ParseField("failures"));
- }
-
- private final int id;
- private final Failure[] failures;
-
- ShardResult(final int id, final Failure[] failures) {
- this.id = id;
- this.failures = failures;
- }
-
- public boolean hasFailures() {
- return failures != null && failures.length > 0;
- }
-
- public int getId() {
- return id;
- }
-
- public Failure[] getFailures() {
- return failures;
- }
-
- static ShardResult fromXContent(final XContentParser parser, final String id) {
- return PARSER.apply(parser, id);
- }
-
- public static class Failure extends DefaultShardOperationFailedException {
-
- static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>(
- "failure",
- true,
- arg -> new Failure((String) arg[0], (int) arg[1], (Throwable) arg[2], (String) arg[3])
- );
-
- static {
- declareFields(PARSER);
- PARSER.declareStringOrNull(optionalConstructorArg(), new ParseField("node"));
- }
-
- private @Nullable String nodeId;
-
- Failure(final String index, final int shardId, final Throwable reason, final String nodeId) {
- super(index, shardId, reason);
- this.nodeId = nodeId;
- }
-
- public String getNodeId() {
- return nodeId;
- }
- }
- }
-}
diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/ComponentTemplatesExistRequest.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/ComponentTemplatesExistRequest.java
deleted file mode 100644
index f52ba5530458..000000000000
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/ComponentTemplatesExistRequest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-
-package org.elasticsearch.client.indices;
-
-import org.elasticsearch.common.Strings;
-
-/**
- * A request to check for the existence of component templates
- */
-public class ComponentTemplatesExistRequest extends GetComponentTemplatesRequest {
-
- /**
- * Create a request to check for the existence of component template. Name must be provided
- *
- * @param name the name of template to check for the existence of
- */
- public ComponentTemplatesExistRequest(String name) {
- super(name);
- if (Strings.isNullOrEmpty(name)) {
- throw new IllegalArgumentException("must provide component template name");
- }
- }
-}
diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/ComposableIndexTemplateExistRequest.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/ComposableIndexTemplateExistRequest.java
deleted file mode 100644
index bcabf4c2921a..000000000000
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/ComposableIndexTemplateExistRequest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-
-package org.elasticsearch.client.indices;
-
-import org.elasticsearch.common.Strings;
-
-/**
- * A request to check for the existence of index templates
- */
-public class ComposableIndexTemplateExistRequest extends GetComponentTemplatesRequest {
-
- /**
- * Create a request to check for the existence of index template. Name must be provided
- *
- * @param name the name of template to check for the existence of
- */
- public ComposableIndexTemplateExistRequest(String name) {
- super(name);
- if (Strings.isNullOrEmpty(name)) {
- throw new IllegalArgumentException("must provide index template name");
- }
- }
-}
diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/CreateDataStreamRequest.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/CreateDataStreamRequest.java
deleted file mode 100644
index 55957ec2faef..000000000000
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/CreateDataStreamRequest.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-
-package org.elasticsearch.client.indices;
-
-import org.elasticsearch.client.Validatable;
-
-public class CreateDataStreamRequest implements Validatable {
-
- private final String name;
-
- public CreateDataStreamRequest(String name) {
- if (name == null) {
- throw new IllegalArgumentException("The data stream name cannot be null.");
- }
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-}
diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/CreateIndexRequest.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/CreateIndexRequest.java
deleted file mode 100644
index 594f23234c7d..000000000000
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/CreateIndexRequest.java
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-
-package org.elasticsearch.client.indices;
-
-import org.elasticsearch.ElasticsearchGenerationException;
-import org.elasticsearch.ElasticsearchParseException;
-import org.elasticsearch.action.admin.indices.alias.Alias;
-import org.elasticsearch.action.support.ActiveShardCount;
-import org.elasticsearch.client.TimedRequest;
-import org.elasticsearch.client.Validatable;
-import org.elasticsearch.common.Strings;
-import org.elasticsearch.common.bytes.BytesArray;
-import org.elasticsearch.common.bytes.BytesReference;
-import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.xcontent.XContentHelper;
-import org.elasticsearch.xcontent.DeprecationHandler;
-import org.elasticsearch.xcontent.NamedXContentRegistry;
-import org.elasticsearch.xcontent.ParseField;
-import org.elasticsearch.xcontent.ToXContentObject;
-import org.elasticsearch.xcontent.XContentBuilder;
-import org.elasticsearch.xcontent.XContentFactory;
-import org.elasticsearch.xcontent.XContentParser;
-import org.elasticsearch.xcontent.XContentType;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-
-/**
- * A request to create an index.
- */
-public class CreateIndexRequest extends TimedRequest implements Validatable, ToXContentObject {
- static final ParseField MAPPINGS = new ParseField("mappings");
- static final ParseField SETTINGS = new ParseField("settings");
- static final ParseField ALIASES = new ParseField("aliases");
-
- private final String index;
- private Settings settings = Settings.EMPTY;
-
- private BytesReference mappings;
- private XContentType mappingsXContentType;
-
- private final Set aliases = new HashSet<>();
-
- private ActiveShardCount waitForActiveShards = ActiveShardCount.DEFAULT;
-
- /**
- * Constructs a new request to create an index with the specified name.
- */
- public CreateIndexRequest(String index) {
- if (index == null) {
- throw new IllegalArgumentException("The index name cannot be null.");
- }
- this.index = index;
- }
-
- /**
- * The name of the index to create.
- */
- public String index() {
- return index;
- }
-
- /**
- * The settings to create the index with.
- */
- public Settings settings() {
- return settings;
- }
-
- /**
- * The settings to create the index with.
- */
- public CreateIndexRequest settings(Settings.Builder settings) {
- this.settings = settings.build();
- return this;
- }
-
- /**
- * The settings to create the index with.
- */
- public CreateIndexRequest settings(Settings settings) {
- this.settings = settings;
- return this;
- }
-
- /**
- * The settings to create the index with (either json or yaml format)
- */
- public CreateIndexRequest settings(String source, XContentType xContentType) {
- this.settings = Settings.builder().loadFromSource(source, xContentType).build();
- return this;
- }
-
- /**
- * Allows to set the settings using a json builder.
- */
- public CreateIndexRequest settings(XContentBuilder builder) {
- settings(Strings.toString(builder), builder.contentType());
- return this;
- }
-
- /**
- * The settings to create the index with (either json/yaml/properties format)
- */
- public CreateIndexRequest settings(Map source) {
- this.settings = Settings.builder().loadFromMap(source).build();
- return this;
- }
-
- public BytesReference mappings() {
- return mappings;
- }
-
- public XContentType mappingsXContentType() {
- return mappingsXContentType;
- }
-
- /**
- * Adds mapping that will be added when the index gets created.
- *
- * Note that the definition should *not* be nested under a type name.
- *
- * @param source The mapping source
- * @param xContentType The content type of the source
- */
- public CreateIndexRequest mapping(String source, XContentType xContentType) {
- return mapping(new BytesArray(source), xContentType);
- }
-
- /**
- * Adds mapping that will be added when the index gets created.
- *
- * Note that the definition should *not* be nested under a type name.
- *
- * @param source The mapping source
- */
- public CreateIndexRequest mapping(XContentBuilder source) {
- return mapping(BytesReference.bytes(source), source.contentType());
- }
-
- /**
- * Adds mapping that will be added when the index gets created.
- *
- * Note that the definition should *not* be nested under a type name.
- *
- * @param source The mapping source
- */
- public CreateIndexRequest mapping(Map source) {
- try {
- XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON);
- builder.map(source);
- return mapping(BytesReference.bytes(builder), builder.contentType());
- } catch (IOException e) {
- throw new ElasticsearchGenerationException("Failed to generate [" + source + "]", e);
- }
- }
-
- /**
- * Adds mapping that will be added when the index gets created.
- *
- * Note that the definition should *not* be nested under a type name.
- *
- * @param source The mapping source
- * @param xContentType the content type of the mapping source
- */
- public CreateIndexRequest mapping(BytesReference source, XContentType xContentType) {
- Objects.requireNonNull(xContentType);
- mappings = source;
- mappingsXContentType = xContentType;
- return this;
- }
-
- public Set aliases() {
- return this.aliases;
- }
-
- /**
- * Sets the aliases that will be associated with the index when it gets created
- */
- public CreateIndexRequest aliases(Map source) {
- try {
- XContentBuilder builder = XContentFactory.jsonBuilder();
- builder.map(source);
- return aliases(BytesReference.bytes(builder), builder.contentType());
- } catch (IOException e) {
- throw new ElasticsearchGenerationException("Failed to generate [" + source + "]", e);
- }
- }
-
- /**
- * Sets the aliases that will be associated with the index when it gets created
- */
- public CreateIndexRequest aliases(XContentBuilder source) {
- return aliases(BytesReference.bytes(source), source.contentType());
- }
-
- /**
- * Sets the aliases that will be associated with the index when it gets created
- */
- public CreateIndexRequest aliases(String source, XContentType contentType) {
- return aliases(new BytesArray(source), contentType);
- }
-
- /**
- * Sets the aliases that will be associated with the index when it gets created
- */
- public CreateIndexRequest aliases(BytesReference source, XContentType contentType) {
- // EMPTY is safe here because we never call namedObject
- try (
- XContentParser parser = XContentHelper.createParser(
- NamedXContentRegistry.EMPTY,
- DeprecationHandler.THROW_UNSUPPORTED_OPERATION,
- source,
- contentType
- )
- ) {
- // move to the first alias
- parser.nextToken();
- while ((parser.nextToken()) != XContentParser.Token.END_OBJECT) {
- alias(Alias.fromXContent(parser));
- }
- return this;
- } catch (IOException e) {
- throw new ElasticsearchParseException("Failed to parse aliases", e);
- }
- }
-
- /**
- * Adds an alias that will be associated with the index when it gets created
- */
- public CreateIndexRequest alias(Alias alias) {
- this.aliases.add(alias);
- return this;
- }
-
- /**
- * Adds aliases that will be associated with the index when it gets created
- */
- public CreateIndexRequest aliases(Collection aliases) {
- this.aliases.addAll(aliases);
- return this;
- }
-
- /**
- * Sets the settings and mappings as a single source.
- *
- * Note that the mapping definition should *not* be nested under a type name.
- */
- public CreateIndexRequest source(String source, XContentType xContentType) {
- return source(new BytesArray(source), xContentType);
- }
-
- /**
- * Sets the settings and mappings as a single source.
- *
- * Note that the mapping definition should *not* be nested under a type name.
- */
- public CreateIndexRequest source(XContentBuilder source) {
- return source(BytesReference.bytes(source), source.contentType());
- }
-
- /**
- * Sets the settings and mappings as a single source.
- *
- * Note that the mapping definition should *not* be nested under a type name.
- */
- public CreateIndexRequest source(BytesReference source, XContentType xContentType) {
- Objects.requireNonNull(xContentType);
- source(XContentHelper.convertToMap(source, false, xContentType).v2());
- return this;
- }
-
- /**
- * Sets the settings and mappings as a single source.
- *
- * Note that the mapping definition should *not* be nested under a type name.
- */
- @SuppressWarnings("unchecked")
- public CreateIndexRequest source(Map source) {
- DeprecationHandler deprecationHandler = DeprecationHandler.THROW_UNSUPPORTED_OPERATION;
- for (Map.Entry entry : source.entrySet()) {
- String name = entry.getKey();
- if (SETTINGS.match(name, deprecationHandler)) {
- settings((Map) entry.getValue());
- } else if (MAPPINGS.match(name, deprecationHandler)) {
- mapping((Map) entry.getValue());
- } else if (ALIASES.match(name, deprecationHandler)) {
- aliases((Map) entry.getValue());
- }
- }
- return this;
- }
-
- public ActiveShardCount waitForActiveShards() {
- return waitForActiveShards;
- }
-
- /**
- * Sets the number of shard copies that should be active for index creation 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.
- * Index creation will only wait up until the timeout value for the number of shard copies
- * to be active before returning. Check {@link CreateIndexResponse#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 CreateIndexRequest waitForActiveShards(ActiveShardCount waitForActiveShards) {
- this.waitForActiveShards = waitForActiveShards;
- return this;
- }
-
- public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
- builder.startObject();
- innerToXContent(builder, params);
- builder.endObject();
- return builder;
- }
-
- public XContentBuilder innerToXContent(XContentBuilder builder, Params params) throws IOException {
- builder.startObject(SETTINGS.getPreferredName());
- settings.toXContent(builder, params);
- builder.endObject();
-
- if (mappings != null) {
- try (InputStream stream = mappings.streamInput()) {
- builder.rawField(MAPPINGS.getPreferredName(), stream, mappingsXContentType);
- }
- }
-
- builder.startObject(ALIASES.getPreferredName());
- for (Alias alias : aliases) {
- alias.toXContent(builder, params);
- }
- builder.endObject();
- return builder;
- }
-}
diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/CreateIndexResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/CreateIndexResponse.java
deleted file mode 100644
index 95d8e1143c06..000000000000
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/CreateIndexResponse.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-
-package org.elasticsearch.client.indices;
-
-import org.elasticsearch.action.support.master.ShardsAcknowledgedResponse;
-import org.elasticsearch.xcontent.ConstructingObjectParser;
-import org.elasticsearch.xcontent.ObjectParser;
-import org.elasticsearch.xcontent.ParseField;
-import org.elasticsearch.xcontent.XContentParser;
-
-import java.util.Objects;
-
-import static org.elasticsearch.xcontent.ConstructingObjectParser.constructorArg;
-
-/**
- * A response for a create index action.
- */
-public class CreateIndexResponse extends ShardsAcknowledgedResponse {
-
- private static final ParseField INDEX = new ParseField("index");
- private static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>(
- "create_index",
- true,
- args -> new CreateIndexResponse((boolean) args[0], (boolean) args[1], (String) args[2])
- );
-
- static {
- declareAcknowledgedAndShardsAcknowledgedFields(PARSER);
- PARSER.declareField(constructorArg(), (parser, context) -> parser.textOrNull(), INDEX, ObjectParser.ValueType.STRING_OR_NULL);
- }
-
- private String index;
-
- public CreateIndexResponse(boolean acknowledged, boolean shardsAcknowledged, String index) {
- super(acknowledged, shardsAcknowledged);
- this.index = index;
- }
-
- public String index() {
- return index;
- }
-
- public static CreateIndexResponse fromXContent(XContentParser parser) {
- return PARSER.apply(parser, null);
- }
-
- @Override
- public boolean equals(Object o) {
- if (super.equals(o)) {
- CreateIndexResponse that = (CreateIndexResponse) o;
- return Objects.equals(index, that.index);
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(super.hashCode(), index);
- }
-}
diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/DataStream.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/DataStream.java
deleted file mode 100644
index 78450a58d50a..000000000000
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/DataStream.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-package org.elasticsearch.client.indices;
-
-import org.elasticsearch.cluster.health.ClusterHealthStatus;
-import org.elasticsearch.core.Nullable;
-import org.elasticsearch.xcontent.ConstructingObjectParser;
-import org.elasticsearch.xcontent.ParseField;
-import org.elasticsearch.xcontent.XContentParser;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.stream.Collectors;
-
-public final class DataStream {
-
- private final String name;
- private final String timeStampField;
- private final List indices;
- private final long generation;
- private final boolean hidden;
- private final boolean system;
- ClusterHealthStatus dataStreamStatus;
- @Nullable
- String indexTemplate;
- @Nullable
- String ilmPolicyName;
- @Nullable
- private final Map metadata;
- private final boolean allowCustomRouting;
- private final boolean replicated;
-
- public DataStream(
- String name,
- String timeStampField,
- List indices,
- long generation,
- ClusterHealthStatus dataStreamStatus,
- @Nullable String indexTemplate,
- @Nullable String ilmPolicyName,
- @Nullable Map metadata,
- boolean hidden,
- boolean system,
- boolean allowCustomRouting,
- boolean replicated
- ) {
- this.name = name;
- this.timeStampField = timeStampField;
- this.indices = indices;
- this.generation = generation;
- this.dataStreamStatus = dataStreamStatus;
- this.indexTemplate = indexTemplate;
- this.ilmPolicyName = ilmPolicyName;
- this.metadata = metadata;
- this.hidden = hidden;
- this.system = system;
- this.allowCustomRouting = allowCustomRouting;
- this.replicated = replicated;
- }
-
- public String getName() {
- return name;
- }
-
- public String getTimeStampField() {
- return timeStampField;
- }
-
- public List getIndices() {
- return indices;
- }
-
- public long getGeneration() {
- return generation;
- }
-
- public ClusterHealthStatus getDataStreamStatus() {
- return dataStreamStatus;
- }
-
- public String getIndexTemplate() {
- return indexTemplate;
- }
-
- public String getIlmPolicyName() {
- return ilmPolicyName;
- }
-
- public Map getMetadata() {
- return metadata;
- }
-
- public boolean isHidden() {
- return hidden;
- }
-
- public boolean isSystem() {
- return system;
- }
-
- public boolean allowsCustomRouting() {
- return allowCustomRouting;
- }
-
- public boolean isReplicated() {
- return replicated;
- }
-
- public static final ParseField NAME_FIELD = new ParseField("name");
- public static final ParseField TIMESTAMP_FIELD_FIELD = new ParseField("timestamp_field");
- public static final ParseField INDICES_FIELD = new ParseField("indices");
- public static final ParseField GENERATION_FIELD = new ParseField("generation");
- public static final ParseField STATUS_FIELD = new ParseField("status");
- public static final ParseField INDEX_TEMPLATE_FIELD = new ParseField("template");
- public static final ParseField ILM_POLICY_FIELD = new ParseField("ilm_policy");
- public static final ParseField METADATA_FIELD = new ParseField("_meta");
- public static final ParseField HIDDEN_FIELD = new ParseField("hidden");
- public static final ParseField SYSTEM_FIELD = new ParseField("system");
- public static final ParseField ALLOW_CUSTOM_ROUTING = new ParseField("allow_custom_routing");
- public static final ParseField REPLICATED = new ParseField("replicated");
-
- @SuppressWarnings("unchecked")
- private static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>("data_stream", args -> {
- String dataStreamName = (String) args[0];
- String timeStampField = (String) ((Map, ?>) args[1]).get("name");
- List indices = ((List