diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/ClusterClient.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/ClusterClient.java
index f3c84db79d65f..488579785e0f7 100644
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/ClusterClient.java
+++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/ClusterClient.java
@@ -41,11 +41,28 @@ public final class ClusterClient {
}
/**
- * Updates cluster wide specific settings using the Cluster Update Settings API
+ * Updates cluster wide specific settings using the Cluster Update Settings API.
+ * See Cluster Update Settings
+ * API on elastic.co
+ * @param clusterUpdateSettingsRequest 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 ClusterUpdateSettingsResponse putSettings(ClusterUpdateSettingsRequest clusterUpdateSettingsRequest, RequestOptions options)
+ throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(clusterUpdateSettingsRequest, RequestConverters::clusterPutSettings,
+ options, ClusterUpdateSettingsResponse::fromXContent, emptySet());
+ }
+
+ /**
+ * Updates cluster wide specific settings using the Cluster Update Settings API.
*
* See Cluster Update Settings
* API on elastic.co
+ * @deprecated Prefer {@link #putSettings(ClusterUpdateSettingsRequest, RequestOptions)}
*/
+ @Deprecated
public ClusterUpdateSettingsResponse putSettings(ClusterUpdateSettingsRequest clusterUpdateSettingsRequest, Header... headers)
throws IOException {
return restHighLevelClient.performRequestAndParseEntity(clusterUpdateSettingsRequest, RequestConverters::clusterPutSettings,
@@ -53,11 +70,26 @@ public ClusterUpdateSettingsResponse putSettings(ClusterUpdateSettingsRequest cl
}
/**
- * Asynchronously updates cluster wide specific settings using the Cluster Update Settings API
+ * Asynchronously updates cluster wide specific settings using the Cluster Update Settings API.
+ * See Cluster Update Settings
+ * API on elastic.co
+ * @param clusterUpdateSettingsRequest 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
+ */
+ public void putSettingsAsync(ClusterUpdateSettingsRequest clusterUpdateSettingsRequest, RequestOptions options,
+ ActionListener listener) {
+ restHighLevelClient.performRequestAsyncAndParseEntity(clusterUpdateSettingsRequest, RequestConverters::clusterPutSettings,
+ options, ClusterUpdateSettingsResponse::fromXContent, listener, emptySet());
+ }
+ /**
+ * Asynchronously updates cluster wide specific settings using the Cluster Update Settings API.
*
* See Cluster Update Settings
* API on elastic.co
+ * @deprecated Prefer {@link #putSettingsAsync(ClusterUpdateSettingsRequest, RequestOptions, ActionListener)}
*/
+ @Deprecated
public void putSettingsAsync(ClusterUpdateSettingsRequest clusterUpdateSettingsRequest,
ActionListener listener, Header... headers) {
restHighLevelClient.performRequestAsyncAndParseEntity(clusterUpdateSettingsRequest, RequestConverters::clusterPutSettings,
diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesClient.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesClient.java
index d51a92ea00fc5..fa7eb9ab9ec8a 100644
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesClient.java
+++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesClient.java
@@ -20,7 +20,6 @@
package org.elasticsearch.client;
import org.apache.http.Header;
-import org.elasticsearch.action.Action;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse;
@@ -47,10 +46,10 @@
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.rollover.RolloverRequest;
import org.elasticsearch.action.admin.indices.rollover.RolloverResponse;
+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.settings.put.UpdateSettingsResponse;
import org.elasticsearch.action.admin.indices.shrink.ResizeRequest;
@@ -76,66 +75,159 @@ public final class IndicesClient {
}
/**
- * Deletes an index using the Delete Index API
+ * 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 DeleteIndexResponse delete(DeleteIndexRequest deleteIndexRequest, RequestOptions options) throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(deleteIndexRequest, RequestConverters::deleteIndex, options,
+ DeleteIndexResponse::fromXContent, emptySet());
+ }
+
+ /**
+ * Deletes an index using the Delete Index API.
*
* See
* Delete Index API on elastic.co
+ * @deprecated Prefer {@link #delete(DeleteIndexRequest, RequestOptions)}
*/
+ @Deprecated
public DeleteIndexResponse delete(DeleteIndexRequest deleteIndexRequest, Header... headers) throws IOException {
return restHighLevelClient.performRequestAndParseEntity(deleteIndexRequest, RequestConverters::deleteIndex,
DeleteIndexResponse::fromXContent, emptySet(), headers);
}
/**
- * Asynchronously deletes an index using the Delete Index API
+ * 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
+ */
+ public void deleteAsync(DeleteIndexRequest deleteIndexRequest, RequestOptions options, ActionListener listener) {
+ restHighLevelClient.performRequestAsyncAndParseEntity(deleteIndexRequest, RequestConverters::deleteIndex, options,
+ DeleteIndexResponse::fromXContent, listener, emptySet());
+ }
+
+ /**
+ * Asynchronously deletes an index using the Delete Index API.
*
* See
* Delete Index API on elastic.co
+ * @deprecated Prefer {@link #deleteAsync(DeleteIndexRequest, RequestOptions, ActionListener)}
*/
+ @Deprecated
public void deleteAsync(DeleteIndexRequest deleteIndexRequest, ActionListener listener, Header... headers) {
restHighLevelClient.performRequestAsyncAndParseEntity(deleteIndexRequest, RequestConverters::deleteIndex,
DeleteIndexResponse::fromXContent, listener, emptySet(), headers);
}
/**
- * Creates an index using the Create Index API
+ * 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, RequestConverters::createIndex, options,
+ CreateIndexResponse::fromXContent, emptySet());
+ }
+
+ /**
+ * Creates an index using the Create Index API.
*
* See
* Create Index API on elastic.co
+ * @deprecated Prefer {@link #create(CreateIndexRequest, RequestOptions)}
*/
+ @Deprecated
public CreateIndexResponse create(CreateIndexRequest createIndexRequest, Header... headers) throws IOException {
return restHighLevelClient.performRequestAndParseEntity(createIndexRequest, RequestConverters::createIndex,
CreateIndexResponse::fromXContent, emptySet(), headers);
}
/**
- * Asynchronously creates an index using the Create Index API
+ * 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
+ */
+ public void createAsync(CreateIndexRequest createIndexRequest, RequestOptions options, ActionListener listener) {
+ restHighLevelClient.performRequestAsyncAndParseEntity(createIndexRequest, RequestConverters::createIndex, options,
+ CreateIndexResponse::fromXContent, listener, emptySet());
+ }
+
+ /**
+ * Asynchronously creates an index using the Create Index API.
*
* See
* Create Index API on elastic.co
+ * @deprecated Prefer {@link #createAsync(CreateIndexRequest, RequestOptions, ActionListener)}
*/
+ @Deprecated
public void createAsync(CreateIndexRequest createIndexRequest, ActionListener listener, Header... headers) {
restHighLevelClient.performRequestAsyncAndParseEntity(createIndexRequest, RequestConverters::createIndex,
CreateIndexResponse::fromXContent, listener, emptySet(), headers);
}
/**
- * Updates the mappings on an index using the Put Mapping API
+ * 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 PutMappingResponse putMapping(PutMappingRequest putMappingRequest, RequestOptions options) throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(putMappingRequest, RequestConverters::putMapping, options,
+ PutMappingResponse::fromXContent, emptySet());
+ }
+
+ /**
+ * Updates the mappings on an index using the Put Mapping API.
*
* See
* Put Mapping API on elastic.co
+ * @deprecated Prefer {@link #putMapping(PutMappingRequest, RequestOptions)}
*/
+ @Deprecated
public PutMappingResponse putMapping(PutMappingRequest putMappingRequest, Header... headers) throws IOException {
return restHighLevelClient.performRequestAndParseEntity(putMappingRequest, RequestConverters::putMapping,
PutMappingResponse::fromXContent, emptySet(), headers);
}
/**
- * Asynchronously updates the mappings on an index using the Put Mapping API
+ * 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
+ */
+ public void putMappingAsync(PutMappingRequest putMappingRequest, RequestOptions options, ActionListener listener) {
+ restHighLevelClient.performRequestAsyncAndParseEntity(putMappingRequest, RequestConverters::putMapping, options,
+ PutMappingResponse::fromXContent, listener, emptySet());
+ }
+
+ /**
+ * Asynchronously updates the mappings on an index using the Put Mapping API.
*
* See
* Put Mapping API on elastic.co
+ * @deprecated Prefer {@link #putMappingAsync(PutMappingRequest, RequestOptions, ActionListener)}
*/
+ @Deprecated
public void putMappingAsync(PutMappingRequest putMappingRequest, ActionListener listener,
Header... headers) {
restHighLevelClient.performRequestAsyncAndParseEntity(putMappingRequest, RequestConverters::putMapping,
@@ -143,242 +235,507 @@ public void putMappingAsync(PutMappingRequest putMappingRequest, ActionListener<
}
/**
- * Retrieves the mappings on an index or indices using the Get Mapping API
- *
+ * 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 getMappings(GetMappingsRequest getMappingsRequest, Header... headers) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(getMappingsRequest, RequestConverters::getMappings,
- GetMappingsResponse::fromXContent, emptySet(), headers);
+ public GetMappingsResponse getMappings(GetMappingsRequest getMappingsRequest, RequestOptions options) throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(getMappingsRequest, RequestConverters::getMappings, options,
+ GetMappingsResponse::fromXContent, emptySet());
}
/**
- * Asynchronously retrieves the mappings on an index on indices using the Get Mapping API
- *
+ * 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
*/
- public void getMappingsAsync(GetMappingsRequest getMappingsRequest, ActionListener listener,
- Header... headers) {
- restHighLevelClient.performRequestAsyncAndParseEntity(getMappingsRequest, RequestConverters::getMappings,
- GetMappingsResponse::fromXContent, listener, emptySet(), headers);
+ public void getMappingsAsync(GetMappingsRequest getMappingsRequest, RequestOptions options,
+ ActionListener listener) {
+ restHighLevelClient.performRequestAsyncAndParseEntity(getMappingsRequest, RequestConverters::getMappings, options,
+ GetMappingsResponse::fromXContent, listener, emptySet());
}
/**
- * Updates aliases using the Index Aliases API
+ * 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 IndicesAliasesResponse updateAliases(IndicesAliasesRequest indicesAliasesRequest, RequestOptions options) throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(indicesAliasesRequest, RequestConverters::updateAliases, options,
+ IndicesAliasesResponse::fromXContent, emptySet());
+ }
+
+ /**
+ * Updates aliases using the Index Aliases API.
*
* See
* Index Aliases API on elastic.co
+ * @deprecated {@link #updateAliases(IndicesAliasesRequest, RequestOptions)}
*/
+ @Deprecated
public IndicesAliasesResponse updateAliases(IndicesAliasesRequest indicesAliasesRequest, Header... headers) throws IOException {
return restHighLevelClient.performRequestAndParseEntity(indicesAliasesRequest, RequestConverters::updateAliases,
IndicesAliasesResponse::fromXContent, emptySet(), headers);
}
/**
- * Asynchronously updates aliases using the Index Aliases API
+ * 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
+ */
+ public void updateAliasesAsync(IndicesAliasesRequest indicesAliasesRequest, RequestOptions options,
+ ActionListener listener) {
+ restHighLevelClient.performRequestAsyncAndParseEntity(indicesAliasesRequest, RequestConverters::updateAliases, options,
+ IndicesAliasesResponse::fromXContent, listener, emptySet());
+ }
+
+ /**
+ * Asynchronously updates aliases using the Index Aliases API.
*
* See
* Index Aliases API on elastic.co
+ * @deprecated Prefer {@link #updateAliasesAsync(IndicesAliasesRequest, RequestOptions, ActionListener)}
*/
+ @Deprecated
public void updateAliasesAsync(IndicesAliasesRequest indicesAliasesRequest, ActionListener listener,
- Header... headers) {
+ Header... headers) {
restHighLevelClient.performRequestAsyncAndParseEntity(indicesAliasesRequest, RequestConverters::updateAliases,
IndicesAliasesResponse::fromXContent, listener, emptySet(), headers);
}
/**
- * Opens an index using the Open Index API
+ * 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, RequestConverters::openIndex, options,
+ OpenIndexResponse::fromXContent, emptySet());
+ }
+
+ /**
+ * Opens an index using the Open Index API.
*
* See
* Open Index API on elastic.co
+ * @deprecated Prefer {@link #open(OpenIndexRequest, RequestOptions)}
*/
+ @Deprecated
public OpenIndexResponse open(OpenIndexRequest openIndexRequest, Header... headers) throws IOException {
return restHighLevelClient.performRequestAndParseEntity(openIndexRequest, RequestConverters::openIndex,
OpenIndexResponse::fromXContent, emptySet(), headers);
}
/**
- * Asynchronously opens an index using the Open Index API
+ * 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
+ */
+ public void openAsync(OpenIndexRequest openIndexRequest, RequestOptions options, ActionListener listener) {
+ restHighLevelClient.performRequestAsyncAndParseEntity(openIndexRequest, RequestConverters::openIndex, options,
+ OpenIndexResponse::fromXContent, listener, emptySet());
+ }
+
+ /**
+ * Asynchronously opens an index using the Open Index API.
*
* See
* Open Index API on elastic.co
+ * @deprecated Prefer {@link #openAsync(OpenIndexRequest, RequestOptions, ActionListener)}
*/
+ @Deprecated
public void openAsync(OpenIndexRequest openIndexRequest, ActionListener listener, Header... headers) {
restHighLevelClient.performRequestAsyncAndParseEntity(openIndexRequest, RequestConverters::openIndex,
OpenIndexResponse::fromXContent, listener, emptySet(), headers);
}
/**
- * Closes an index using the Close Index API
+ * 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, RequestConverters::closeIndex, options,
+ CloseIndexResponse::fromXContent, emptySet());
+ }
+
+ /**
+ * Closes an index using the Close Index API.
*
* See
* Close Index API on elastic.co
+ * @deprecated Prefer {@link #close(CloseIndexRequest, RequestOptions)}
*/
+ @Deprecated
public CloseIndexResponse close(CloseIndexRequest closeIndexRequest, Header... headers) throws IOException {
return restHighLevelClient.performRequestAndParseEntity(closeIndexRequest, RequestConverters::closeIndex,
CloseIndexResponse::fromXContent, emptySet(), headers);
}
/**
- * Asynchronously closes an index using the Close Index API
+ * 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
+ */
+ public void closeAsync(CloseIndexRequest closeIndexRequest, RequestOptions options, ActionListener listener) {
+ restHighLevelClient.performRequestAsyncAndParseEntity(closeIndexRequest, RequestConverters::closeIndex, options,
+ CloseIndexResponse::fromXContent, listener, emptySet());
+ }
+
+
+ /**
+ * Asynchronously closes an index using the Close Index API.
*
* See
* Close Index API on elastic.co
+ * @deprecated Prefer {@link #closeAsync(CloseIndexRequest, RequestOptions, ActionListener)}
*/
+ @Deprecated
public void closeAsync(CloseIndexRequest closeIndexRequest, ActionListener listener, Header... headers) {
restHighLevelClient.performRequestAsyncAndParseEntity(closeIndexRequest, RequestConverters::closeIndex,
CloseIndexResponse::fromXContent, listener, emptySet(), headers);
}
/**
- * Checks if one or more aliases exist using the Aliases Exist API
+ * 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, RequestConverters::existsAlias, options,
+ RestHighLevelClient::convertExistsResponse, emptySet());
+ }
+
+ /**
+ * Checks if one or more aliases exist using the Aliases Exist API.
*
* See
* Indices Aliases API on elastic.co
+ * @deprecated Prefer {@link #existsAlias(GetAliasesRequest, RequestOptions)}
*/
+ @Deprecated
public boolean existsAlias(GetAliasesRequest getAliasesRequest, Header... headers) throws IOException {
return restHighLevelClient.performRequest(getAliasesRequest, RequestConverters::existsAlias,
RestHighLevelClient::convertExistsResponse, emptySet(), headers);
}
/**
- * Asynchronously checks if one or more aliases exist using the Aliases Exist API
+ * 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
+ */
+ public void existsAliasAsync(GetAliasesRequest getAliasesRequest, RequestOptions options, ActionListener listener) {
+ restHighLevelClient.performRequestAsync(getAliasesRequest, RequestConverters::existsAlias, options,
+ RestHighLevelClient::convertExistsResponse, listener, emptySet());
+ }
+
+ /**
+ * Asynchronously checks if one or more aliases exist using the Aliases Exist API.
*
* See
* Indices Aliases API on elastic.co
+ * @deprecated Prefer {@link #existsAliasAsync(GetAliasesRequest, RequestOptions, ActionListener)}
*/
+ @Deprecated
public void existsAliasAsync(GetAliasesRequest getAliasesRequest, ActionListener listener, Header... headers) {
restHighLevelClient.performRequestAsync(getAliasesRequest, RequestConverters::existsAlias,
RestHighLevelClient::convertExistsResponse, listener, emptySet(), headers);
}
/**
- * Refresh one or more indices using the Refresh API
+ * 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, RequestConverters::refresh, options,
+ RefreshResponse::fromXContent, emptySet());
+ }
+
+ /**
+ * Refresh one or more indices using the Refresh API.
*
* See Refresh API on elastic.co
+ * @deprecated Prefer {@link #refresh(RefreshRequest, RequestOptions)}
*/
+ @Deprecated
public RefreshResponse refresh(RefreshRequest refreshRequest, Header... headers) throws IOException {
return restHighLevelClient.performRequestAndParseEntity(refreshRequest, RequestConverters::refresh, RefreshResponse::fromXContent,
emptySet(), headers);
}
/**
- * Asynchronously refresh one or more indices using the Refresh API
+ * 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
+ */
+ public void refreshAsync(RefreshRequest refreshRequest, RequestOptions options, ActionListener listener) {
+ restHighLevelClient.performRequestAsyncAndParseEntity(refreshRequest, RequestConverters::refresh, options,
+ RefreshResponse::fromXContent, listener, emptySet());
+ }
+
+ /**
+ * Asynchronously refresh one or more indices using the Refresh API.
*
* See Refresh API on elastic.co
+ * @deprecated Prefer {@link #refreshAsync(RefreshRequest, RequestOptions, ActionListener)}
*/
+ @Deprecated
public void refreshAsync(RefreshRequest refreshRequest, ActionListener listener, Header... headers) {
restHighLevelClient.performRequestAsyncAndParseEntity(refreshRequest, RequestConverters::refresh, RefreshResponse::fromXContent,
listener, emptySet(), headers);
}
/**
- * Flush one or more indices using the Flush API
+ * 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, RequestConverters::flush, options,
+ FlushResponse::fromXContent, emptySet());
+ }
+
+ /**
+ * Flush one or more indices using the Flush API.
*
* See Flush API on elastic.co
+ * @deprecated Prefer {@link #flush(FlushRequest, RequestOptions)}
*/
+ @Deprecated
public FlushResponse flush(FlushRequest flushRequest, Header... headers) throws IOException {
return restHighLevelClient.performRequestAndParseEntity(flushRequest, RequestConverters::flush, FlushResponse::fromXContent,
emptySet(), headers);
}
/**
- * Asynchronously flush one or more indices using the Flush API
+ * 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
+ */
+ public void flushAsync(FlushRequest flushRequest, RequestOptions options, ActionListener listener) {
+ restHighLevelClient.performRequestAsyncAndParseEntity(flushRequest, RequestConverters::flush, options,
+ FlushResponse::fromXContent, listener, emptySet());
+ }
+
+ /**
+ * Asynchronously flush one or more indices using the Flush API.
*
* See Flush API on elastic.co
+ * @deprecated Prefer {@link #flushAsync(FlushRequest, RequestOptions, ActionListener)}
*/
+ @Deprecated
public void flushAsync(FlushRequest flushRequest, ActionListener listener, Header... headers) {
restHighLevelClient.performRequestAsyncAndParseEntity(flushRequest, RequestConverters::flush, FlushResponse::fromXContent,
listener, emptySet(), headers);
}
- /** Initiate a synced flush manually using the synced flush API
- *
- * See
- * Synced flush API on elastic.co
- */
- public SyncedFlushResponse flushSynced(SyncedFlushRequest syncedFlushRequest, Header... headers) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(syncedFlushRequest, RequestConverters::flushSynced,
- SyncedFlushResponse::fromXContent, emptySet(), headers);
+ /**
+ * Initiate a synced flush manually using the synced flush API.
+ * See
+ * Synced flush API on elastic.co
+ * @param syncedFlushRequest 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 SyncedFlushResponse flushSynced(SyncedFlushRequest syncedFlushRequest, RequestOptions options) throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(syncedFlushRequest, RequestConverters::flushSynced, options,
+ SyncedFlushResponse::fromXContent, emptySet());
}
/**
- * Asynchronously initiate a synced flush manually using the synced flush API
- *
+ * Asynchronously initiate a synced flush manually using the synced flush API.
* See
* Synced flush API on elastic.co
+ * @param syncedFlushRequest 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
*/
- public void flushSyncedAsync(SyncedFlushRequest syncedFlushRequest, ActionListener listener, Header... headers) {
- restHighLevelClient.performRequestAsyncAndParseEntity(syncedFlushRequest, RequestConverters::flushSynced,
- SyncedFlushResponse::fromXContent, listener, emptySet(), headers);
+ public void flushSyncedAsync(SyncedFlushRequest syncedFlushRequest, RequestOptions options,
+ ActionListener listener) {
+ restHighLevelClient.performRequestAsyncAndParseEntity(syncedFlushRequest, RequestConverters::flushSynced, options,
+ SyncedFlushResponse::fromXContent, listener, emptySet());
}
-
/**
- * Retrieve the settings of one or more indices
- *
+ * 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, Header... headers) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(getSettingsRequest, RequestConverters::getSettings,
- GetSettingsResponse::fromXContent, emptySet(), headers);
+ public GetSettingsResponse getSettings(GetSettingsRequest getSettingsRequest, RequestOptions options) throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(getSettingsRequest, RequestConverters::getSettings, options,
+ GetSettingsResponse::fromXContent, emptySet());
}
/**
- * Asynchronously retrieve the settings of one or more indices
- *
+ * 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
+ */
+ public void getSettingsAsync(GetSettingsRequest getSettingsRequest, RequestOptions options,
+ ActionListener listener) {
+ restHighLevelClient.performRequestAsyncAndParseEntity(getSettingsRequest, RequestConverters::getSettings, options,
+ GetSettingsResponse::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
*/
- public void getSettingsAsync(GetSettingsRequest getSettingsRequest, ActionListener listener, Header... headers) {
- restHighLevelClient.performRequestAsyncAndParseEntity(getSettingsRequest, RequestConverters::getSettings,
- GetSettingsResponse::fromXContent, listener, emptySet(), headers);
+ public ForceMergeResponse forceMerge(ForceMergeRequest forceMergeRequest, RequestOptions options) throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(forceMergeRequest, RequestConverters::forceMerge, options,
+ ForceMergeResponse::fromXContent, emptySet());
}
/**
- * Force merge one or more indices using the Force Merge API
+ * Force merge one or more indices using the Force Merge API.
*
* See
* Force Merge API on elastic.co
+ * @deprecated Prefer {@link #forceMerge(ForceMergeRequest, RequestOptions)}
*/
+ @Deprecated
public ForceMergeResponse forceMerge(ForceMergeRequest forceMergeRequest, Header... headers) throws IOException {
return restHighLevelClient.performRequestAndParseEntity(forceMergeRequest, RequestConverters::forceMerge,
ForceMergeResponse::fromXContent, emptySet(), headers);
}
/**
- * Asynchronously force merge one or more indices using the Force Merge API
+ * 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
+ */
+ public void forceMergeAsync(ForceMergeRequest forceMergeRequest, RequestOptions options, ActionListener listener) {
+ restHighLevelClient.performRequestAsyncAndParseEntity(forceMergeRequest, RequestConverters::forceMerge, options,
+ ForceMergeResponse::fromXContent, listener, emptySet());
+ }
+
+ /**
+ * Asynchronously force merge one or more indices using the Force Merge API.
*
* See
* Force Merge API on elastic.co
+ * @deprecated Prefer {@link #forceMergeAsync(ForceMergeRequest, RequestOptions, ActionListener)}
*/
+ @Deprecated
public void forceMergeAsync(ForceMergeRequest forceMergeRequest, ActionListener listener, Header... headers) {
restHighLevelClient.performRequestAsyncAndParseEntity(forceMergeRequest, RequestConverters::forceMerge,
ForceMergeResponse::fromXContent, listener, emptySet(), headers);
}
/**
- * Clears the cache of one or more indices using the Clear Cache API
+ * 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, RequestConverters::clearCache, options,
+ ClearIndicesCacheResponse::fromXContent, emptySet());
+ }
+
+ /**
+ * Clears the cache of one or more indices using the Clear Cache API.
*
* See
* Clear Cache API on elastic.co
+ * @deprecated Prefer {@link #clearCache(ClearIndicesCacheRequest, RequestOptions)}
*/
+ @Deprecated
public ClearIndicesCacheResponse clearCache(ClearIndicesCacheRequest clearIndicesCacheRequest, Header... headers) throws IOException {
return restHighLevelClient.performRequestAndParseEntity(clearIndicesCacheRequest, RequestConverters::clearCache,
ClearIndicesCacheResponse::fromXContent, emptySet(), headers);
}
/**
- * Asynchronously clears the cache of one or more indices using the Clear Cache API
+ * 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
+ */
+ public void clearCacheAsync(ClearIndicesCacheRequest clearIndicesCacheRequest, RequestOptions options,
+ ActionListener listener) {
+ restHighLevelClient.performRequestAsyncAndParseEntity(clearIndicesCacheRequest, RequestConverters::clearCache, options,
+ ClearIndicesCacheResponse::fromXContent, listener, emptySet());
+ }
+
+ /**
+ * Asynchronously clears the cache of one or more indices using the Clear Cache API.
*
* See
* Clear Cache API on elastic.co
+ * @deprecated Prefer {@link #clearCacheAsync(ClearIndicesCacheRequest, RequestOptions, ActionListener)}
*/
+ @Deprecated
public void clearCacheAsync(ClearIndicesCacheRequest clearIndicesCacheRequest, ActionListener listener,
Header... headers) {
restHighLevelClient.performRequestAsyncAndParseEntity(clearIndicesCacheRequest, RequestConverters::clearCache,
@@ -387,17 +744,57 @@ public void clearCacheAsync(ClearIndicesCacheRequest clearIndicesCacheRequest, A
/**
* 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, Header... headers) throws IOException {
+ public boolean exists(GetIndexRequest request, RequestOptions options) throws IOException {
return restHighLevelClient.performRequest(
request,
RequestConverters::indicesExist,
+ options,
RestHighLevelClient::convertExistsResponse,
- Collections.emptySet(),
- headers
+ Collections.emptySet()
+ );
+ }
+
+ /**
+ * Checks if the index (indices) exists or not.
+ *
+ * See
+ * Indices Exists API on elastic.co
+ * @deprecated Prefer {@link #exists(GetIndexRequest, RequestOptions)}
+ */
+ @Deprecated
+ public boolean exists(GetIndexRequest request, Header... headers) throws IOException {
+ return restHighLevelClient.performRequest(
+ request,
+ RequestConverters::indicesExist,
+ RestHighLevelClient::convertExistsResponse,
+ Collections.emptySet(),
+ headers
+ );
+ }
+
+ /**
+ * 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
+ */
+ public void existsAsync(GetIndexRequest request, RequestOptions options, ActionListener listener) {
+ restHighLevelClient.performRequestAsync(
+ request,
+ RequestConverters::indicesExist,
+ options,
+ RestHighLevelClient::convertExistsResponse,
+ listener,
+ Collections.emptySet()
);
}
@@ -406,7 +803,9 @@ public boolean exists(GetIndexRequest request, Header... headers) throws IOExcep
*
* See
* Indices Exists API on elastic.co
+ * @deprecated Prefer {@link #existsAsync(GetIndexRequest, RequestOptions, ActionListener)}
*/
+ @Deprecated
public void existsAsync(GetIndexRequest request, ActionListener listener, Header... headers) {
restHighLevelClient.performRequestAsync(
request,
@@ -419,88 +818,213 @@ public void existsAsync(GetIndexRequest request, ActionListener listene
}
/**
- * Shrinks an index using the Shrink Index API
+ * 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, RequestConverters::shrink, options,
+ ResizeResponse::fromXContent, emptySet());
+ }
+
+ /**
+ * Shrinks an index using the Shrink Index API.
*
* See
* Shrink Index API on elastic.co
+ * @deprecated Prefer {@link #shrink(ResizeRequest, RequestOptions)}
*/
+ @Deprecated
public ResizeResponse shrink(ResizeRequest resizeRequest, Header... headers) throws IOException {
return restHighLevelClient.performRequestAndParseEntity(resizeRequest, RequestConverters::shrink, ResizeResponse::fromXContent,
emptySet(), headers);
}
/**
- * Asynchronously shrinks an index using the Shrink index API
+ * 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
+ */
+ public void shrinkAsync(ResizeRequest resizeRequest, RequestOptions options, ActionListener listener) {
+ restHighLevelClient.performRequestAsyncAndParseEntity(resizeRequest, RequestConverters::shrink, options,
+ ResizeResponse::fromXContent, listener, emptySet());
+ }
+
+ /**
+ * Asynchronously shrinks an index using the Shrink index API.
*
* See
* Shrink Index API on elastic.co
+ * @deprecated Prefer {@link #shrinkAsync(ResizeRequest, RequestOptions, ActionListener)}
*/
+ @Deprecated
public void shrinkAsync(ResizeRequest resizeRequest, ActionListener listener, Header... headers) {
restHighLevelClient.performRequestAsyncAndParseEntity(resizeRequest, RequestConverters::shrink, ResizeResponse::fromXContent,
listener, emptySet(), headers);
}
/**
- * Splits an index using the Split Index API
+ * 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, RequestConverters::split, options,
+ ResizeResponse::fromXContent, emptySet());
+ }
+
+ /**
+ * Splits an index using the Split Index API.
*
* See
* Split Index API on elastic.co
+ * @deprecated {@link #split(ResizeRequest, RequestOptions)}
*/
+ @Deprecated
public ResizeResponse split(ResizeRequest resizeRequest, Header... headers) throws IOException {
return restHighLevelClient.performRequestAndParseEntity(resizeRequest, RequestConverters::split, ResizeResponse::fromXContent,
emptySet(), headers);
}
/**
- * Asynchronously splits an index using the Split Index API
+ * 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
+ */
+ public void splitAsync(ResizeRequest resizeRequest, RequestOptions options, ActionListener listener) {
+ restHighLevelClient.performRequestAsyncAndParseEntity(resizeRequest, RequestConverters::split, options,
+ ResizeResponse::fromXContent, listener, emptySet());
+ }
+
+ /**
+ * Asynchronously splits an index using the Split Index API.
*
* See
* Split Index API on elastic.co
+ * @deprecated Prefer {@link #splitAsync(ResizeRequest, RequestOptions, ActionListener)}
*/
+ @Deprecated
public void splitAsync(ResizeRequest resizeRequest, ActionListener listener, Header... headers) {
restHighLevelClient.performRequestAsyncAndParseEntity(resizeRequest, RequestConverters::split, ResizeResponse::fromXContent,
listener, emptySet(), headers);
}
/**
- * Rolls over an index using the Rollover Index API
+ * 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, RequestConverters::rollover, options,
+ RolloverResponse::fromXContent, emptySet());
+ }
+
+ /**
+ * Rolls over an index using the Rollover Index API.
*
* See
* Rollover Index API on elastic.co
+ * @deprecated Prefer {@link #rollover(RolloverRequest, RequestOptions)}
*/
+ @Deprecated
public RolloverResponse rollover(RolloverRequest rolloverRequest, Header... headers) throws IOException {
return restHighLevelClient.performRequestAndParseEntity(rolloverRequest, RequestConverters::rollover,
RolloverResponse::fromXContent, emptySet(), headers);
}
/**
- * Asynchronously rolls over an index using the Rollover Index API
+ * 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
+ */
+ public void rolloverAsync(RolloverRequest rolloverRequest, RequestOptions options, ActionListener listener) {
+ restHighLevelClient.performRequestAsyncAndParseEntity(rolloverRequest, RequestConverters::rollover, options,
+ RolloverResponse::fromXContent, listener, emptySet());
+ }
+
+ /**
+ * Asynchronously rolls over an index using the Rollover Index API.
*
* See
* Rollover Index API on elastic.co
+ * @deprecated Prefer {@link #rolloverAsync(RolloverRequest, RequestOptions, ActionListener)}
*/
+ @Deprecated
public void rolloverAsync(RolloverRequest rolloverRequest, ActionListener listener, Header... headers) {
restHighLevelClient.performRequestAsyncAndParseEntity(rolloverRequest, RequestConverters::rollover, RolloverResponse::fromXContent,
listener, emptySet(), headers);
}
/**
- * Updates specific index level settings using the Update Indices Settings API
+ * 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 UpdateSettingsResponse putSettings(UpdateSettingsRequest updateSettingsRequest, RequestOptions options) throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(updateSettingsRequest, RequestConverters::indexPutSettings, options,
+ UpdateSettingsResponse::fromXContent, emptySet());
+ }
+
+ /**
+ * Updates specific index level settings using the Update Indices Settings API.
*
* See Update Indices Settings
* API on elastic.co
+ * @deprecated Prefer {@link #putSettings(UpdateSettingsRequest, RequestOptions)}
*/
+ @Deprecated
public UpdateSettingsResponse putSettings(UpdateSettingsRequest updateSettingsRequest, Header... headers) throws IOException {
return restHighLevelClient.performRequestAndParseEntity(updateSettingsRequest, RequestConverters::indexPutSettings,
UpdateSettingsResponse::fromXContent, emptySet(), headers);
}
/**
- * Asynchronously updates specific index level settings using the Update Indices Settings API
+ * 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
+ */
+ public void putSettingsAsync(UpdateSettingsRequest updateSettingsRequest, RequestOptions options,
+ ActionListener listener) {
+ restHighLevelClient.performRequestAsyncAndParseEntity(updateSettingsRequest, RequestConverters::indexPutSettings, options,
+ UpdateSettingsResponse::fromXContent, listener, emptySet());
+ }
+
+ /**
+ * Asynchronously updates specific index level settings using the Update Indices Settings API.
*
* See Update Indices Settings
* API on elastic.co
+ * @deprecated Prefer {@link #putSettingsAsync(UpdateSettingsRequest, RequestOptions, ActionListener)}
*/
+ @Deprecated
public void putSettingsAsync(UpdateSettingsRequest updateSettingsRequest, ActionListener listener,
Header... headers) {
restHighLevelClient.performRequestAsyncAndParseEntity(updateSettingsRequest, RequestConverters::indexPutSettings,
@@ -508,25 +1032,31 @@ public void putSettingsAsync(UpdateSettingsRequest updateSettingsRequest, Action
}
/**
- * Puts an index template using the Index Templates API
- *
+ * 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 PutIndexTemplateResponse putTemplate(PutIndexTemplateRequest putIndexTemplateRequest, Header... headers) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(putIndexTemplateRequest, RequestConverters::putTemplate,
- PutIndexTemplateResponse::fromXContent, emptySet(), headers);
+ public PutIndexTemplateResponse putTemplate(PutIndexTemplateRequest putIndexTemplateRequest,
+ RequestOptions options) throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(putIndexTemplateRequest, RequestConverters::putTemplate, options,
+ PutIndexTemplateResponse::fromXContent, emptySet());
}
/**
- * Asynchronously puts an index template using the Index Templates API
- *
+ * 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
*/
- public void putTemplateAsync(PutIndexTemplateRequest putIndexTemplateRequest,
- ActionListener listener, Header... headers) {
- restHighLevelClient.performRequestAsyncAndParseEntity(putIndexTemplateRequest, RequestConverters::putTemplate,
- PutIndexTemplateResponse::fromXContent, listener, emptySet(), headers);
+ public void putTemplateAsync(PutIndexTemplateRequest putIndexTemplateRequest, RequestOptions options,
+ ActionListener listener) {
+ restHighLevelClient.performRequestAsyncAndParseEntity(putIndexTemplateRequest, RequestConverters::putTemplate, options,
+ PutIndexTemplateResponse::fromXContent, listener, emptySet());
}
}
diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/IngestClient.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/IngestClient.java
index 72b1813f93909..5c5a82b52f438 100644
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/IngestClient.java
+++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/IngestClient.java
@@ -19,7 +19,6 @@
package org.elasticsearch.client;
-import org.apache.http.Header;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.ingest.DeletePipelineRequest;
import org.elasticsearch.action.ingest.GetPipelineRequest;
@@ -45,70 +44,85 @@ public final class IngestClient {
}
/**
- * Add a pipeline or update an existing pipeline
- *
+ * Add a pipeline or update an existing pipeline.
* See
* Put Pipeline 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 or parsing back the response
*/
- public WritePipelineResponse putPipeline(PutPipelineRequest request, Header... headers) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity( request, RequestConverters::putPipeline,
- WritePipelineResponse::fromXContent, emptySet(), headers);
+ public WritePipelineResponse putPipeline(PutPipelineRequest request, RequestOptions options) throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity( request, RequestConverters::putPipeline, options,
+ WritePipelineResponse::fromXContent, emptySet());
}
/**
- * Asynchronously add a pipeline or update an existing pipeline
- *
+ * Asynchronously add a pipeline or update an existing pipeline.
* See
* Put Pipeline 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
*/
- public void putPipelineAsync(PutPipelineRequest request, ActionListener listener, Header... headers) {
- restHighLevelClient.performRequestAsyncAndParseEntity( request, RequestConverters::putPipeline,
- WritePipelineResponse::fromXContent, listener, emptySet(), headers);
+ public void putPipelineAsync(PutPipelineRequest request, RequestOptions options, ActionListener listener) {
+ restHighLevelClient.performRequestAsyncAndParseEntity( request, RequestConverters::putPipeline, options,
+ WritePipelineResponse::fromXContent, listener, emptySet());
}
/**
- * Get an existing pipeline
- *
+ * Get an existing pipeline.
* See
* Get Pipeline 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 or parsing back the response
*/
- public GetPipelineResponse getPipeline(GetPipelineRequest request, Header... headers) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity( request, RequestConverters::getPipeline,
- GetPipelineResponse::fromXContent, emptySet(), headers);
+ public GetPipelineResponse getPipeline(GetPipelineRequest request, RequestOptions options) throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity( request, RequestConverters::getPipeline, options,
+ GetPipelineResponse::fromXContent, emptySet());
}
/**
- * Asynchronously get an existing pipeline
- *
+ * Asynchronously get an existing pipeline.
* See
* Get Pipeline 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
*/
- public void getPipelineAsync(GetPipelineRequest request, ActionListener listener, Header... headers) {
- restHighLevelClient.performRequestAsyncAndParseEntity( request, RequestConverters::getPipeline,
- GetPipelineResponse::fromXContent, listener, emptySet(), headers);
+ public void getPipelineAsync(GetPipelineRequest request, RequestOptions options, ActionListener listener) {
+ restHighLevelClient.performRequestAsyncAndParseEntity( request, RequestConverters::getPipeline, options,
+ GetPipelineResponse::fromXContent, listener, emptySet());
}
/**
- * Delete an existing pipeline
- *
+ * Delete an existing pipeline.
* See
*
* Delete Pipeline 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 or parsing back the response
*/
- public WritePipelineResponse deletePipeline(DeletePipelineRequest request, Header... headers) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity( request, RequestConverters::deletePipeline,
- WritePipelineResponse::fromXContent, emptySet(), headers);
+ public WritePipelineResponse deletePipeline(DeletePipelineRequest request, RequestOptions options) throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity( request, RequestConverters::deletePipeline, options,
+ WritePipelineResponse::fromXContent, emptySet());
}
/**
- * Asynchronously delete an existing pipeline
- *
+ * Asynchronously delete an existing pipeline.
* See
*
* Delete Pipeline 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
*/
- public void deletePipelineAsync(DeletePipelineRequest request, ActionListener listener, Header... headers) {
- restHighLevelClient.performRequestAsyncAndParseEntity( request, RequestConverters::deletePipeline,
- WritePipelineResponse::fromXContent, listener, emptySet(), headers);
+ public void deletePipelineAsync(DeletePipelineRequest request, RequestOptions options, ActionListener listener) {
+ restHighLevelClient.performRequestAsyncAndParseEntity( request, RequestConverters::deletePipeline, options,
+ WritePipelineResponse::fromXContent, listener, emptySet());
}
}
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 e5a45e19fe0d3..b061289888c0c 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
@@ -710,7 +710,7 @@ static Request rollover(RolloverRequest rolloverRequest) throws IOException {
return request;
}
- static Request getSettings(GetSettingsRequest getSettingsRequest) throws IOException {
+ 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();
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 a9587b73c1959..8980508c48738 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
@@ -285,16 +285,19 @@ public final TasksClient tasks() {
}
/**
- * Executes a bulk request using the Bulk API
- *
+ * Executes a bulk request using the Bulk API.
* See Bulk API on elastic.co
+ * @param bulkRequest 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 final BulkResponse bulk(BulkRequest bulkRequest, RequestOptions options) throws IOException {
return performRequestAndParseEntity(bulkRequest, RequestConverters::bulk, options, BulkResponse::fromXContent, emptySet());
}
/**
- * Executes a bulk request using the Bulk API
+ * Executes a bulk request using the Bulk API.
*
* See Bulk API on elastic.co
* @deprecated Prefer {@link #bulk(BulkRequest, RequestOptions)}
@@ -305,16 +308,18 @@ public final BulkResponse bulk(BulkRequest bulkRequest, Header... headers) throw
}
/**
- * Asynchronously executes a bulk request using the Bulk API
- *
+ * Asynchronously executes a bulk request using the Bulk API.
* See Bulk API on elastic.co
+ * @param bulkRequest 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
*/
public final void bulkAsync(BulkRequest bulkRequest, RequestOptions options, ActionListener listener) {
performRequestAsyncAndParseEntity(bulkRequest, RequestConverters::bulk, options, BulkResponse::fromXContent, listener, emptySet());
}
/**
- * Asynchronously executes a bulk request using the Bulk API
+ * Asynchronously executes a bulk request using the Bulk API.
*
* See Bulk API on elastic.co
* @deprecated Prefer {@link #bulkAsync(BulkRequest, RequestOptions, ActionListener)}
@@ -326,194 +331,482 @@ public final void bulkAsync(BulkRequest bulkRequest, ActionListenertrue if the ping succeeded, false otherwise
+ * @throws IOException in case there is a problem sending the request
+ */
+ public final boolean ping(RequestOptions options) throws IOException {
+ return performRequest(new MainRequest(), (request) -> RequestConverters.ping(), options, RestHighLevelClient::convertExistsResponse,
+ emptySet());
+ }
+
+ /**
+ * Pings the remote Elasticsearch cluster and returns true if the ping succeeded, false otherwise
+ * @deprecated Prefer {@link #ping(RequestOptions)}
*/
+ @Deprecated
public final boolean ping(Header... headers) throws IOException {
return performRequest(new MainRequest(), (request) -> RequestConverters.ping(), RestHighLevelClient::convertExistsResponse,
emptySet(), headers);
}
+ /**
+ * Get the cluster info otherwise provided when sending an HTTP request to '/'
+ * @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 final MainResponse info(RequestOptions options) throws IOException {
+ return performRequestAndParseEntity(new MainRequest(), (request) -> RequestConverters.info(), options,
+ MainResponse::fromXContent, emptySet());
+ }
+
/**
* Get the cluster info otherwise provided when sending an HTTP request to port 9200
+ * @deprecated Prefer {@link #info(RequestOptions)}
*/
+ @Deprecated
public final MainResponse info(Header... headers) throws IOException {
return performRequestAndParseEntity(new MainRequest(), (request) -> RequestConverters.info(),
MainResponse::fromXContent, emptySet(), headers);
}
/**
- * Retrieves a document by id using the Get API
+ * Retrieves a document by id using the Get API.
+ * See Get API on elastic.co
+ * @param getRequest 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 final GetResponse get(GetRequest getRequest, RequestOptions options) throws IOException {
+ return performRequestAndParseEntity(getRequest, RequestConverters::get, options, GetResponse::fromXContent, singleton(404));
+ }
+
+ /**
+ * Retrieves a document by id using the Get API.
*
* See Get API on elastic.co
+ * @deprecated Prefer {@link #get(GetRequest, RequestOptions)}
*/
+ @Deprecated
public final GetResponse get(GetRequest getRequest, Header... headers) throws IOException {
return performRequestAndParseEntity(getRequest, RequestConverters::get, GetResponse::fromXContent, singleton(404), headers);
}
/**
- * Asynchronously retrieves a document by id using the Get API
+ * Asynchronously retrieves a document by id using the Get API.
+ * See Get API on elastic.co
+ * @param getRequest 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
+ */
+ public final void getAsync(GetRequest getRequest, RequestOptions options, ActionListener listener) {
+ performRequestAsyncAndParseEntity(getRequest, RequestConverters::get, options, GetResponse::fromXContent, listener,
+ singleton(404));
+ }
+
+ /**
+ * Asynchronously retrieves a document by id using the Get API.
*
* See Get API on elastic.co
+ * @deprecated Prefer {@link #getAsync(GetRequest, RequestOptions, ActionListener)}
*/
+ @Deprecated
public final void getAsync(GetRequest getRequest, ActionListener listener, Header... headers) {
performRequestAsyncAndParseEntity(getRequest, RequestConverters::get, GetResponse::fromXContent, listener,
singleton(404), headers);
}
/**
- * Retrieves multiple documents by id using the Multi Get API
+ * Retrieves multiple documents by id using the Multi Get API.
+ * See Multi Get API on elastic.co
+ * @param multiGetRequest 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 final MultiGetResponse multiGet(MultiGetRequest multiGetRequest, RequestOptions options) throws IOException {
+ return performRequestAndParseEntity(multiGetRequest, RequestConverters::multiGet, options, MultiGetResponse::fromXContent,
+ singleton(404));
+ }
+
+ /**
+ * Retrieves multiple documents by id using the Multi Get API.
*
* See Multi Get API on elastic.co
+ * @deprecated Prefer {@link #multiGet(MultiGetRequest, RequestOptions)}
*/
+ @Deprecated
public final MultiGetResponse multiGet(MultiGetRequest multiGetRequest, Header... headers) throws IOException {
return performRequestAndParseEntity(multiGetRequest, RequestConverters::multiGet, MultiGetResponse::fromXContent,
singleton(404), headers);
}
/**
- * Asynchronously retrieves multiple documents by id using the Multi Get API
+ * Asynchronously retrieves multiple documents by id using the Multi Get API.
+ * See Multi Get API on elastic.co
+ * @param multiGetRequest 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
+ */
+ public final void multiGetAsync(MultiGetRequest multiGetRequest, RequestOptions options, ActionListener listener) {
+ performRequestAsyncAndParseEntity(multiGetRequest, RequestConverters::multiGet, options, MultiGetResponse::fromXContent, listener,
+ singleton(404));
+ }
+
+ /**
+ * Asynchronously retrieves multiple documents by id using the Multi Get API.
*
* See Multi Get API on elastic.co
+ * @deprecated Prefer {@link #multiGetAsync(MultiGetRequest, RequestOptions, ActionListener)}
*/
+ @Deprecated
public final void multiGetAsync(MultiGetRequest multiGetRequest, ActionListener listener, Header... headers) {
performRequestAsyncAndParseEntity(multiGetRequest, RequestConverters::multiGet, MultiGetResponse::fromXContent, listener,
singleton(404), headers);
}
/**
- * Checks for the existence of a document. Returns true if it exists, false otherwise
+ * Checks for the existence of a document. Returns true if it exists, false otherwise.
+ * See Get API on elastic.co
+ * @param getRequest the request
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
+ * @return true if the document exists, false otherwise
+ * @throws IOException in case there is a problem sending the request
+ */
+ public final boolean exists(GetRequest getRequest, RequestOptions options) throws IOException {
+ return performRequest(getRequest, RequestConverters::exists, options, RestHighLevelClient::convertExistsResponse, emptySet());
+ }
+
+ /**
+ * Checks for the existence of a document. Returns true if it exists, false otherwise.
*
* See Get API on elastic.co
+ * @deprecated Prefer {@link #exists(GetRequest, RequestOptions)}
*/
+ @Deprecated
public final boolean exists(GetRequest getRequest, Header... headers) throws IOException {
return performRequest(getRequest, RequestConverters::exists, RestHighLevelClient::convertExistsResponse, emptySet(), headers);
}
/**
- * Asynchronously checks for the existence of a document. Returns true if it exists, false otherwise
+ * Asynchronously checks for the existence of a document. Returns true if it exists, false otherwise.
+ * See Get API on elastic.co
+ * @param getRequest 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
+ */
+ public final void existsAsync(GetRequest getRequest, RequestOptions options, ActionListener listener) {
+ performRequestAsync(getRequest, RequestConverters::exists, options, RestHighLevelClient::convertExistsResponse, listener,
+ emptySet());
+ }
+
+ /**
+ * Asynchronously checks for the existence of a document. Returns true if it exists, false otherwise.
*
* See Get API on elastic.co
+ * @deprecated Prefer {@link #existsAsync(GetRequest, RequestOptions, ActionListener)}
*/
+ @Deprecated
public final void existsAsync(GetRequest getRequest, ActionListener listener, Header... headers) {
performRequestAsync(getRequest, RequestConverters::exists, RestHighLevelClient::convertExistsResponse, listener,
emptySet(), headers);
}
/**
- * Index a document using the Index API
+ * Index a document using the Index API.
+ * See Index API on elastic.co
+ * @param indexRequest 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 final IndexResponse index(IndexRequest indexRequest, RequestOptions options) throws IOException {
+ return performRequestAndParseEntity(indexRequest, RequestConverters::index, options, IndexResponse::fromXContent, emptySet());
+ }
+
+ /**
+ * Index a document using the Index API.
*
* See Index API on elastic.co
+ * @deprecated Prefer {@link #index(IndexRequest, RequestOptions)}
*/
+ @Deprecated
public final IndexResponse index(IndexRequest indexRequest, Header... headers) throws IOException {
return performRequestAndParseEntity(indexRequest, RequestConverters::index, IndexResponse::fromXContent, emptySet(), headers);
}
/**
- * Asynchronously index a document using the Index API
+ * Asynchronously index a document using the Index API.
+ * See Index API on elastic.co
+ * @param indexRequest 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
+ */
+ public final void indexAsync(IndexRequest indexRequest, RequestOptions options, ActionListener listener) {
+ performRequestAsyncAndParseEntity(indexRequest, RequestConverters::index, options, IndexResponse::fromXContent, listener,
+ emptySet());
+ }
+
+ /**
+ * Asynchronously index a document using the Index API.
*
* See Index API on elastic.co
+ * @deprecated Prefer {@link #indexAsync(IndexRequest, RequestOptions, ActionListener)}
*/
+ @Deprecated
public final void indexAsync(IndexRequest indexRequest, ActionListener listener, Header... headers) {
performRequestAsyncAndParseEntity(indexRequest, RequestConverters::index, IndexResponse::fromXContent, listener,
emptySet(), headers);
}
/**
- * Updates a document using the Update API
+ * Updates a document using the Update API.
+ * See Update API on elastic.co
+ * @param updateRequest 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 final UpdateResponse update(UpdateRequest updateRequest, RequestOptions options) throws IOException {
+ return performRequestAndParseEntity(updateRequest, RequestConverters::update, options, UpdateResponse::fromXContent, emptySet());
+ }
+
+ /**
+ * Updates a document using the Update API.
*
* See Update API on elastic.co
+ * @deprecated Prefer {@link #update(UpdateRequest, RequestOptions)}
*/
+ @Deprecated
public final UpdateResponse update(UpdateRequest updateRequest, Header... headers) throws IOException {
return performRequestAndParseEntity(updateRequest, RequestConverters::update, UpdateResponse::fromXContent, emptySet(), headers);
}
/**
- * Asynchronously updates a document using the Update API
+ * Asynchronously updates a document using the Update API.
+ * See Update API on elastic.co
+ * @param updateRequest 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
+ */
+ public final void updateAsync(UpdateRequest updateRequest, RequestOptions options, ActionListener listener) {
+ performRequestAsyncAndParseEntity(updateRequest, RequestConverters::update, options, UpdateResponse::fromXContent, listener,
+ emptySet());
+ }
+
+ /**
+ * Asynchronously updates a document using the Update API.
*
* See Update API on elastic.co
+ * @deprecated Prefer {@link #updateAsync(UpdateRequest, RequestOptions, ActionListener)}
*/
+ @Deprecated
public final void updateAsync(UpdateRequest updateRequest, ActionListener listener, Header... headers) {
performRequestAsyncAndParseEntity(updateRequest, RequestConverters::update, UpdateResponse::fromXContent, listener,
emptySet(), headers);
}
/**
- * Deletes a document by id using the Delete API
+ * Deletes a document by id using the Delete API.
+ * See Delete API on elastic.co
+ * @param deleteRequest the reuqest
+ * @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 final DeleteResponse delete(DeleteRequest deleteRequest, RequestOptions options) throws IOException {
+ return performRequestAndParseEntity(deleteRequest, RequestConverters::delete, options, DeleteResponse::fromXContent,
+ singleton(404));
+ }
+
+ /**
+ * Deletes a document by id using the Delete API.
*
* See Delete API on elastic.co
+ * @deprecated Prefer {@link #delete(DeleteRequest, RequestOptions)}
*/
+ @Deprecated
public final DeleteResponse delete(DeleteRequest deleteRequest, Header... headers) throws IOException {
return performRequestAndParseEntity(deleteRequest, RequestConverters::delete, DeleteResponse::fromXContent,
singleton(404), headers);
}
/**
- * Asynchronously deletes a document by id using the Delete API
+ * Asynchronously deletes a document by id using the Delete API.
+ * See Delete API on elastic.co
+ * @param deleteRequest 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
+ */
+ public final void deleteAsync(DeleteRequest deleteRequest, RequestOptions options, ActionListener listener) {
+ performRequestAsyncAndParseEntity(deleteRequest, RequestConverters::delete, options, DeleteResponse::fromXContent, listener,
+ Collections.singleton(404));
+ }
+
+ /**
+ * Asynchronously deletes a document by id using the Delete API.
*
* See Delete API on elastic.co
+ * @deprecated Prefer {@link #deleteAsync(DeleteRequest, RequestOptions, ActionListener)}
*/
+ @Deprecated
public final void deleteAsync(DeleteRequest deleteRequest, ActionListener listener, Header... headers) {
performRequestAsyncAndParseEntity(deleteRequest, RequestConverters::delete, DeleteResponse::fromXContent, listener,
- Collections.singleton(404), headers);
+ Collections.singleton(404), headers);
+ }
+
+ /**
+ * Executes a search request using the Search API.
+ * See Search API on elastic.co
+ * @param searchRequest 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 final SearchResponse search(SearchRequest searchRequest, RequestOptions options) throws IOException {
+ return performRequestAndParseEntity(searchRequest, RequestConverters::search, options, SearchResponse::fromXContent, emptySet());
}
/**
- * Executes a search using the Search API
+ * Executes a search using the Search API.
*
* See Search API on elastic.co
+ * @deprecated Prefer {@link #search(SearchRequest, RequestOptions)}
*/
+ @Deprecated
public final SearchResponse search(SearchRequest searchRequest, Header... headers) throws IOException {
return performRequestAndParseEntity(searchRequest, RequestConverters::search, SearchResponse::fromXContent, emptySet(), headers);
}
/**
- * Asynchronously executes a search using the Search API
+ * Asynchronously executes a search using the Search API.
+ * See Search API on elastic.co
+ * @param searchRequest 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
+ */
+ public final void searchAsync(SearchRequest searchRequest, RequestOptions options, ActionListener listener) {
+ performRequestAsyncAndParseEntity(searchRequest, RequestConverters::search, options, SearchResponse::fromXContent, listener,
+ emptySet());
+ }
+
+ /**
+ * Asynchronously executes a search using the Search API.
*
* See Search API on elastic.co
+ * @deprecated Prefer {@link #searchAsync(SearchRequest, RequestOptions, ActionListener)}
*/
+ @Deprecated
public final void searchAsync(SearchRequest searchRequest, ActionListener listener, Header... headers) {
performRequestAsyncAndParseEntity(searchRequest, RequestConverters::search, SearchResponse::fromXContent, listener,
emptySet(), headers);
}
/**
- * Executes a multi search using the msearch API
+ * Executes a multi search using the msearch API.
+ * See Multi search API on
+ * elastic.co
+ * @param multiSearchRequest 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 final MultiSearchResponse multiSearch(MultiSearchRequest multiSearchRequest, RequestOptions options) throws IOException {
+ return performRequestAndParseEntity(multiSearchRequest, RequestConverters::multiSearch, options, MultiSearchResponse::fromXContext,
+ emptySet());
+ }
+
+ /**
+ * Executes a multi search using the msearch API.
*
* See Multi search API on
* elastic.co
+ * @deprecated Prefer {@link #multiSearch(MultiSearchRequest, RequestOptions)}
*/
+ @Deprecated
public final MultiSearchResponse multiSearch(MultiSearchRequest multiSearchRequest, Header... headers) throws IOException {
return performRequestAndParseEntity(multiSearchRequest, RequestConverters::multiSearch, MultiSearchResponse::fromXContext,
emptySet(), headers);
}
/**
- * Asynchronously executes a multi search using the msearch API
+ * Asynchronously executes a multi search using the msearch API.
+ * See Multi search API on
+ * elastic.co
+ * @param searchRequest 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
+ */
+ public final void multiSearchAsync(MultiSearchRequest searchRequest, RequestOptions options,
+ ActionListener listener) {
+ performRequestAsyncAndParseEntity(searchRequest, RequestConverters::multiSearch, options, MultiSearchResponse::fromXContext,
+ listener, emptySet());
+ }
+
+ /**
+ * Asynchronously executes a multi search using the msearch API.
*
* See Multi search API on
* elastic.co
+ * @deprecated Prefer {@link #multiSearchAsync(MultiSearchRequest, RequestOptions, ActionListener)}
*/
+ @Deprecated
public final void multiSearchAsync(MultiSearchRequest searchRequest, ActionListener listener, Header... headers) {
performRequestAsyncAndParseEntity(searchRequest, RequestConverters::multiSearch, MultiSearchResponse::fromXContext, listener,
emptySet(), headers);
}
/**
- * Executes a search using the Search Scroll API
+ * Executes a search using the Search Scroll API.
+ * See Search Scroll
+ * API on elastic.co
+ * @param searchScrollRequest 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 final SearchResponse searchScroll(SearchScrollRequest searchScrollRequest, RequestOptions options) throws IOException {
+ return performRequestAndParseEntity(searchScrollRequest, RequestConverters::searchScroll, options, SearchResponse::fromXContent,
+ emptySet());
+ }
+
+ /**
+ * Executes a search using the Search Scroll API.
*
* See Search Scroll
* API on elastic.co
+ * @deprecated Prefer {@link #searchScroll(SearchScrollRequest, RequestOptions)}
*/
+ @Deprecated
public final SearchResponse searchScroll(SearchScrollRequest searchScrollRequest, Header... headers) throws IOException {
return performRequestAndParseEntity(searchScrollRequest, RequestConverters::searchScroll, SearchResponse::fromXContent,
emptySet(), headers);
}
/**
- * Asynchronously executes a search using the Search Scroll API
+ * Asynchronously executes a search using the Search Scroll API.
+ * See Search Scroll
+ * API on elastic.co
+ * @param searchScrollRequest 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
+ */
+ public final void searchScrollAsync(SearchScrollRequest searchScrollRequest, RequestOptions options,
+ ActionListener listener) {
+ performRequestAsyncAndParseEntity(searchScrollRequest, RequestConverters::searchScroll, options, SearchResponse::fromXContent,
+ listener, emptySet());
+ }
+
+ /**
+ * Asynchronously executes a search using the Search Scroll API.
*
* See Search Scroll
* API on elastic.co
+ * @deprecated Prefer {@link #searchScrollAsync(SearchScrollRequest, RequestOptions, ActionListener)}
*/
+ @Deprecated
public final void searchScrollAsync(SearchScrollRequest searchScrollRequest,
ActionListener listener, Header... headers) {
performRequestAsyncAndParseEntity(searchScrollRequest, RequestConverters::searchScroll, SearchResponse::fromXContent,
@@ -521,22 +814,54 @@ public final void searchScrollAsync(SearchScrollRequest searchScrollRequest,
}
/**
- * Clears one or more scroll ids using the Clear Scroll API
+ * Clears one or more scroll ids using the Clear Scroll API.
+ * See
+ * Clear Scroll API on elastic.co
+ * @param clearScrollRequest 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 final ClearScrollResponse clearScroll(ClearScrollRequest clearScrollRequest, RequestOptions options) throws IOException {
+ return performRequestAndParseEntity(clearScrollRequest, RequestConverters::clearScroll, options, ClearScrollResponse::fromXContent,
+ emptySet());
+ }
+
+ /**
+ * Clears one or more scroll ids using the Clear Scroll API.
*
* See
* Clear Scroll API on elastic.co
+ * @deprecated Prefer {@link #clearScroll(ClearScrollRequest, RequestOptions)}
*/
+ @Deprecated
public final ClearScrollResponse clearScroll(ClearScrollRequest clearScrollRequest, Header... headers) throws IOException {
return performRequestAndParseEntity(clearScrollRequest, RequestConverters::clearScroll, ClearScrollResponse::fromXContent,
emptySet(), headers);
}
/**
- * Asynchronously clears one or more scroll ids using the Clear Scroll API
+ * Asynchronously clears one or more scroll ids using the Clear Scroll API.
+ * See
+ * Clear Scroll API on elastic.co
+ * @param clearScrollRequest the reuqest
+ * @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
+ */
+ public final void clearScrollAsync(ClearScrollRequest clearScrollRequest, RequestOptions options,
+ ActionListener listener) {
+ performRequestAsyncAndParseEntity(clearScrollRequest, RequestConverters::clearScroll, options, ClearScrollResponse::fromXContent,
+ listener, emptySet());
+ }
+
+ /**
+ * Asynchronously clears one or more scroll ids using the Clear Scroll API.
*
* See
* Clear Scroll API on elastic.co
+ * @deprecated Prefer {@link #clearScrollAsync(ClearScrollRequest, RequestOptions, ActionListener)}
*/
+ @Deprecated
public final void clearScrollAsync(ClearScrollRequest clearScrollRequest,
ActionListener listener, Header... headers) {
performRequestAsyncAndParseEntity(clearScrollRequest, RequestConverters::clearScroll, ClearScrollResponse::fromXContent,
@@ -545,47 +870,79 @@ public final void clearScrollAsync(ClearScrollRequest clearScrollRequest,
/**
* Executes a request using the Search Template API.
- *
* See Search Template API
* on elastic.co.
+ * @param searchTemplateRequest 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 final SearchTemplateResponse searchTemplate(SearchTemplateRequest searchTemplateRequest,
- Header... headers) throws IOException {
- return performRequestAndParseEntity(searchTemplateRequest, RequestConverters::searchTemplate,
- SearchTemplateResponse::fromXContent, emptySet(), headers);
+ RequestOptions options) throws IOException {
+ return performRequestAndParseEntity(searchTemplateRequest, RequestConverters::searchTemplate, options,
+ SearchTemplateResponse::fromXContent, emptySet());
}
/**
- * Asynchronously executes a request using the Search Template API
+ * Asynchronously executes a request using the Search Template API.
*
* See Search Template API
* on elastic.co.
*/
- public final void searchTemplateAsync(SearchTemplateRequest searchTemplateRequest,
- ActionListener listener,
- Header... headers) {
- performRequestAsyncAndParseEntity(searchTemplateRequest, RequestConverters::searchTemplate,
- SearchTemplateResponse::fromXContent, listener, emptySet(), headers);
+ public final void searchTemplateAsync(SearchTemplateRequest searchTemplateRequest, RequestOptions options,
+ ActionListener listener) {
+ performRequestAsyncAndParseEntity(searchTemplateRequest, RequestConverters::searchTemplate, options,
+ SearchTemplateResponse::fromXContent, listener, emptySet());
}
+ /**
+ * Executes a request using the Ranking Evaluation API.
+ * See Ranking Evaluation API
+ * on elastic.co
+ * @param rankEvalRequest 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 final RankEvalResponse rankEval(RankEvalRequest rankEvalRequest, RequestOptions options) throws IOException {
+ return performRequestAndParseEntity(rankEvalRequest, RequestConverters::rankEval, options, RankEvalResponse::fromXContent,
+ emptySet());
+ }
/**
* Executes a request using the Ranking Evaluation API.
*
* See Ranking Evaluation API
* on elastic.co
+ * @deprecated Prefer {@link #rankEval(RankEvalRequest, RequestOptions)}
*/
+ @Deprecated
public final RankEvalResponse rankEval(RankEvalRequest rankEvalRequest, Header... headers) throws IOException {
return performRequestAndParseEntity(rankEvalRequest, RequestConverters::rankEval, RankEvalResponse::fromXContent,
emptySet(), headers);
}
+ /**
+ * Asynchronously executes a request using the Ranking Evaluation API.
+ * See Ranking Evaluation API
+ * on elastic.co
+ * @param rankEvalRequest 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
+ */
+ public final void rankEvalAsync(RankEvalRequest rankEvalRequest, RequestOptions options, ActionListener listener) {
+ performRequestAsyncAndParseEntity(rankEvalRequest, RequestConverters::rankEval, options, RankEvalResponse::fromXContent, listener,
+ emptySet());
+ }
+
/**
* Asynchronously executes a request using the Ranking Evaluation API.
*
* See Ranking Evaluation API
* on elastic.co
+ * @deprecated Prefer {@link #rankEvalAsync(RankEvalRequest, RequestOptions, ActionListener)}
*/
+ @Deprecated
public final void rankEvalAsync(RankEvalRequest rankEvalRequest, ActionListener listener, Header... headers) {
performRequestAsyncAndParseEntity(rankEvalRequest, RequestConverters::rankEval, RankEvalResponse::fromXContent, listener,
emptySet(), headers);
@@ -593,27 +950,31 @@ public final void rankEvalAsync(RankEvalRequest rankEvalRequest, ActionListener<
/**
* Executes a request using the Field Capabilities API.
- *
* See Field Capabilities API
* on elastic.co.
+ * @param fieldCapabilitiesRequest 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 final FieldCapabilitiesResponse fieldCaps(FieldCapabilitiesRequest fieldCapabilitiesRequest,
- Header... headers) throws IOException {
- return performRequestAndParseEntity(fieldCapabilitiesRequest, RequestConverters::fieldCaps,
- FieldCapabilitiesResponse::fromXContent, emptySet(), headers);
+ RequestOptions options) throws IOException {
+ return performRequestAndParseEntity(fieldCapabilitiesRequest, RequestConverters::fieldCaps, options,
+ FieldCapabilitiesResponse::fromXContent, emptySet());
}
/**
* Asynchronously executes a request using the Field Capabilities API.
- *
* See Field Capabilities API
* on elastic.co.
+ * @param fieldCapabilitiesRequest 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
*/
- public final void fieldCapsAsync(FieldCapabilitiesRequest fieldCapabilitiesRequest,
- ActionListener listener,
- Header... headers) {
- performRequestAsyncAndParseEntity(fieldCapabilitiesRequest, RequestConverters::fieldCaps,
- FieldCapabilitiesResponse::fromXContent, listener, emptySet(), headers);
+ public final void fieldCapsAsync(FieldCapabilitiesRequest fieldCapabilitiesRequest, RequestOptions options,
+ ActionListener listener) {
+ performRequestAsyncAndParseEntity(fieldCapabilitiesRequest, RequestConverters::fieldCaps, options,
+ FieldCapabilitiesResponse::fromXContent, listener, emptySet());
}
@Deprecated
diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/SnapshotClient.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/SnapshotClient.java
index 104bc91271148..b7cd2d52732cc 100644
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/SnapshotClient.java
+++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/SnapshotClient.java
@@ -19,7 +19,6 @@
package org.elasticsearch.client;
-import org.apache.http.Header;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryRequest;
import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryResponse;
@@ -49,97 +48,117 @@ public final class SnapshotClient {
/**
* Gets a list of snapshot repositories. If the list of repositories is empty or it contains a single element "_all", all
* registered repositories are returned.
- *
* See Snapshot and Restore
* API on elastic.co
+ * @param getRepositoriesRequest 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 GetRepositoriesResponse getRepositories(GetRepositoriesRequest getRepositoriesRequest, Header... headers)
+ public GetRepositoriesResponse getRepositories(GetRepositoriesRequest getRepositoriesRequest, RequestOptions options)
throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(getRepositoriesRequest, RequestConverters::getRepositories,
- GetRepositoriesResponse::fromXContent, emptySet(), headers);
+ return restHighLevelClient.performRequestAndParseEntity(getRepositoriesRequest, RequestConverters::getRepositories, options,
+ GetRepositoriesResponse::fromXContent, emptySet());
}
/**
* Asynchronously gets a list of snapshot repositories. If the list of repositories is empty or it contains a single element "_all", all
* registered repositories are returned.
- *
* See Snapshot and Restore
* API on elastic.co
+ * @param getRepositoriesRequest 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
*/
- public void getRepositoriesAsync(GetRepositoriesRequest getRepositoriesRequest,
- ActionListener listener, Header... headers) {
- restHighLevelClient.performRequestAsyncAndParseEntity(getRepositoriesRequest, RequestConverters::getRepositories,
- GetRepositoriesResponse::fromXContent, listener, emptySet(), headers);
+ public void getRepositoriesAsync(GetRepositoriesRequest getRepositoriesRequest, RequestOptions options,
+ ActionListener listener) {
+ restHighLevelClient.performRequestAsyncAndParseEntity(getRepositoriesRequest, RequestConverters::getRepositories, options,
+ GetRepositoriesResponse::fromXContent, listener, emptySet());
}
/**
* Creates a snapshot repository.
- *
* See Snapshot and Restore
* API on elastic.co
+ * @param putRepositoryRequest 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 PutRepositoryResponse createRepository(PutRepositoryRequest putRepositoryRequest, Header... headers) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(putRepositoryRequest, RequestConverters::createRepository,
- PutRepositoryResponse::fromXContent, emptySet(), headers);
+ public PutRepositoryResponse createRepository(PutRepositoryRequest putRepositoryRequest, RequestOptions options) throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(putRepositoryRequest, RequestConverters::createRepository, options,
+ PutRepositoryResponse::fromXContent, emptySet());
}
/**
* Asynchronously creates a snapshot repository.
- *
* See Snapshot and Restore
* API on elastic.co
+ * @param putRepositoryRequest 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
*/
- public void createRepositoryAsync(PutRepositoryRequest putRepositoryRequest,
- ActionListener listener, Header... headers) {
- restHighLevelClient.performRequestAsyncAndParseEntity(putRepositoryRequest, RequestConverters::createRepository,
- PutRepositoryResponse::fromXContent, listener, emptySet(), headers);
+ public void createRepositoryAsync(PutRepositoryRequest putRepositoryRequest, RequestOptions options,
+ ActionListener listener) {
+ restHighLevelClient.performRequestAsyncAndParseEntity(putRepositoryRequest, RequestConverters::createRepository, options,
+ PutRepositoryResponse::fromXContent, listener, emptySet());
}
/**
* Deletes a snapshot repository.
- *
* See Snapshot and Restore
* API on elastic.co
+ * @param deleteRepositoryRequest 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 DeleteRepositoryResponse deleteRepository(DeleteRepositoryRequest deleteRepositoryRequest, Header... headers)
+ public DeleteRepositoryResponse deleteRepository(DeleteRepositoryRequest deleteRepositoryRequest, RequestOptions options)
throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(deleteRepositoryRequest, RequestConverters::deleteRepository,
- DeleteRepositoryResponse::fromXContent, emptySet(), headers);
+ return restHighLevelClient.performRequestAndParseEntity(deleteRepositoryRequest, RequestConverters::deleteRepository, options,
+ DeleteRepositoryResponse::fromXContent, emptySet());
}
/**
* Asynchronously deletes a snapshot repository.
- *
* See Snapshot and Restore
* API on elastic.co
+ * @param deleteRepositoryRequest 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
*/
- public void deleteRepositoryAsync(DeleteRepositoryRequest deleteRepositoryRequest,
- ActionListener listener, Header... headers) {
- restHighLevelClient.performRequestAsyncAndParseEntity(deleteRepositoryRequest, RequestConverters::deleteRepository,
- DeleteRepositoryResponse::fromXContent, listener, emptySet(), headers);
+ public void deleteRepositoryAsync(DeleteRepositoryRequest deleteRepositoryRequest, RequestOptions options,
+ ActionListener listener) {
+ restHighLevelClient.performRequestAsyncAndParseEntity(deleteRepositoryRequest, RequestConverters::deleteRepository, options,
+ DeleteRepositoryResponse::fromXContent, listener, emptySet());
}
/**
* Verifies a snapshot repository.
- *
* See Snapshot and Restore
* API on elastic.co
+ * @param verifyRepositoryRequest 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 VerifyRepositoryResponse verifyRepository(VerifyRepositoryRequest verifyRepositoryRequest, Header... headers)
+ public VerifyRepositoryResponse verifyRepository(VerifyRepositoryRequest verifyRepositoryRequest, RequestOptions options)
throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(verifyRepositoryRequest, RequestConverters::verifyRepository,
- VerifyRepositoryResponse::fromXContent, emptySet(), headers);
+ return restHighLevelClient.performRequestAndParseEntity(verifyRepositoryRequest, RequestConverters::verifyRepository, options,
+ VerifyRepositoryResponse::fromXContent, emptySet());
}
/**
* Asynchronously verifies a snapshot repository.
- *
* See Snapshot and Restore
* API on elastic.co
+ * @param verifyRepositoryRequest 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
*/
- public void verifyRepositoryAsync(VerifyRepositoryRequest verifyRepositoryRequest,
- ActionListener listener, Header... headers) {
- restHighLevelClient.performRequestAsyncAndParseEntity(verifyRepositoryRequest, RequestConverters::verifyRepository,
- VerifyRepositoryResponse::fromXContent, listener, emptySet(), headers);
+ public void verifyRepositoryAsync(VerifyRepositoryRequest verifyRepositoryRequest, RequestOptions options,
+ ActionListener listener) {
+ restHighLevelClient.performRequestAsyncAndParseEntity(verifyRepositoryRequest, RequestConverters::verifyRepository, options,
+ VerifyRepositoryResponse::fromXContent, listener, emptySet());
}
}
diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/TasksClient.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/TasksClient.java
index 214f1e7884a2a..f4a76e78b946b 100644
--- a/client/rest-high-level/src/main/java/org/elasticsearch/client/TasksClient.java
+++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/TasksClient.java
@@ -19,7 +19,6 @@
package org.elasticsearch.client;
-import org.apache.http.Header;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksRequest;
import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksResponse;
@@ -33,7 +32,7 @@
*
* See Task Management API on elastic.co
*/
-public class TasksClient {
+public final class TasksClient {
private final RestHighLevelClient restHighLevelClient;
TasksClient(RestHighLevelClient restHighLevelClient) {
@@ -41,24 +40,29 @@ public class TasksClient {
}
/**
- * Get current tasks using the Task Management API
- *
+ * Get current tasks using the Task Management API.
* See
* Task Management 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 or parsing back the response
*/
- public ListTasksResponse list(ListTasksRequest request, Header... headers) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(request, RequestConverters::listTasks, ListTasksResponse::fromXContent,
- emptySet(), headers);
+ public ListTasksResponse list(ListTasksRequest request, RequestOptions options) throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(request, RequestConverters::listTasks, options,
+ ListTasksResponse::fromXContent, emptySet());
}
/**
- * Asynchronously get current tasks using the Task Management API
- *