REST high-level Client: remove deprecated API methods (#31200)
This commit removes all the API methods that accept a `Header` varargs argument, in favour of the newly introduced API methods that accept a `RequestOptions` argument. Relates to #31069
This commit is contained in:
parent
bd81b95e95
commit
92eb324776
|
@ -19,7 +19,6 @@
|
|||
|
||||
package org.elasticsearch.client;
|
||||
|
||||
import org.apache.http.Header;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
||||
|
@ -59,20 +58,6 @@ public final class ClusterClient {
|
|||
options, ClusterUpdateSettingsResponse::fromXContent, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates cluster wide specific settings using the Cluster Update Settings API.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-update-settings.html"> Cluster Update Settings
|
||||
* API on elastic.co</a>
|
||||
* @deprecated Prefer {@link #putSettings(ClusterUpdateSettingsRequest, RequestOptions)}
|
||||
*/
|
||||
@Deprecated
|
||||
public ClusterUpdateSettingsResponse putSettings(ClusterUpdateSettingsRequest clusterUpdateSettingsRequest, Header... headers)
|
||||
throws IOException {
|
||||
return restHighLevelClient.performRequestAndParseEntity(clusterUpdateSettingsRequest, RequestConverters::clusterPutSettings,
|
||||
ClusterUpdateSettingsResponse::fromXContent, emptySet(), headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously updates cluster wide specific settings using the Cluster Update Settings API.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-update-settings.html"> Cluster Update Settings
|
||||
|
@ -86,19 +71,6 @@ public final class ClusterClient {
|
|||
restHighLevelClient.performRequestAsyncAndParseEntity(clusterUpdateSettingsRequest, RequestConverters::clusterPutSettings,
|
||||
options, ClusterUpdateSettingsResponse::fromXContent, listener, emptySet());
|
||||
}
|
||||
/**
|
||||
* Asynchronously updates cluster wide specific settings using the Cluster Update Settings API.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-update-settings.html"> Cluster Update Settings
|
||||
* API on elastic.co</a>
|
||||
* @deprecated Prefer {@link #putSettingsAsync(ClusterUpdateSettingsRequest, RequestOptions, ActionListener)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void putSettingsAsync(ClusterUpdateSettingsRequest clusterUpdateSettingsRequest,
|
||||
ActionListener<ClusterUpdateSettingsResponse> listener, Header... headers) {
|
||||
restHighLevelClient.performRequestAsyncAndParseEntity(clusterUpdateSettingsRequest, RequestConverters::clusterPutSettings,
|
||||
ClusterUpdateSettingsResponse::fromXContent, listener, emptySet(), headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cluster health using the Cluster Health API.
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
package org.elasticsearch.client;
|
||||
|
||||
import org.apache.http.Header;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse;
|
||||
|
@ -92,19 +91,6 @@ public final class IndicesClient {
|
|||
DeleteIndexResponse::fromXContent, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes an index using the Delete Index API.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-index.html">
|
||||
* Delete Index API on elastic.co</a>
|
||||
* @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.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-index.html">
|
||||
|
@ -118,19 +104,6 @@ public final class IndicesClient {
|
|||
DeleteIndexResponse::fromXContent, listener, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously deletes an index using the Delete Index API.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-index.html">
|
||||
* Delete Index API on elastic.co</a>
|
||||
* @deprecated Prefer {@link #deleteAsync(DeleteIndexRequest, RequestOptions, ActionListener)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void deleteAsync(DeleteIndexRequest deleteIndexRequest, ActionListener<DeleteIndexResponse> listener, Header... headers) {
|
||||
restHighLevelClient.performRequestAsyncAndParseEntity(deleteIndexRequest, RequestConverters::deleteIndex,
|
||||
DeleteIndexResponse::fromXContent, listener, emptySet(), headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an index using the Create Index API.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html">
|
||||
|
@ -145,19 +118,6 @@ public final class IndicesClient {
|
|||
CreateIndexResponse::fromXContent, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an index using the Create Index API.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html">
|
||||
* Create Index API on elastic.co</a>
|
||||
* @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.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html">
|
||||
|
@ -171,19 +131,6 @@ public final class IndicesClient {
|
|||
CreateIndexResponse::fromXContent, listener, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously creates an index using the Create Index API.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html">
|
||||
* Create Index API on elastic.co</a>
|
||||
* @deprecated Prefer {@link #createAsync(CreateIndexRequest, RequestOptions, ActionListener)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void createAsync(CreateIndexRequest createIndexRequest, ActionListener<CreateIndexResponse> listener, Header... headers) {
|
||||
restHighLevelClient.performRequestAsyncAndParseEntity(createIndexRequest, RequestConverters::createIndex,
|
||||
CreateIndexResponse::fromXContent, listener, emptySet(), headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the mappings on an index using the Put Mapping API.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html">
|
||||
|
@ -198,19 +145,6 @@ public final class IndicesClient {
|
|||
PutMappingResponse::fromXContent, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the mappings on an index using the Put Mapping API.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html">
|
||||
* Put Mapping API on elastic.co</a>
|
||||
* @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.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html">
|
||||
|
@ -224,20 +158,6 @@ public final class IndicesClient {
|
|||
PutMappingResponse::fromXContent, listener, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously updates the mappings on an index using the Put Mapping API.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html">
|
||||
* Put Mapping API on elastic.co</a>
|
||||
* @deprecated Prefer {@link #putMappingAsync(PutMappingRequest, RequestOptions, ActionListener)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void putMappingAsync(PutMappingRequest putMappingRequest, ActionListener<PutMappingResponse> listener,
|
||||
Header... headers) {
|
||||
restHighLevelClient.performRequestAsyncAndParseEntity(putMappingRequest, RequestConverters::putMapping,
|
||||
PutMappingResponse::fromXContent, listener, emptySet(), headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the mappings on an index or indices using the Get Mapping API.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-mapping.html">
|
||||
|
@ -280,20 +200,6 @@ public final class IndicesClient {
|
|||
IndicesAliasesResponse::fromXContent, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates aliases using the Index Aliases API.
|
||||
* <p>
|
||||
* See <a href=
|
||||
* "https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html">
|
||||
* Index Aliases API on elastic.co</a>
|
||||
* @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.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html">
|
||||
|
@ -308,21 +214,6 @@ public final class IndicesClient {
|
|||
IndicesAliasesResponse::fromXContent, listener, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously updates aliases using the Index Aliases API.
|
||||
* <p>
|
||||
* See <a href=
|
||||
* "https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html">
|
||||
* Index Aliases API on elastic.co</a>
|
||||
* @deprecated Prefer {@link #updateAliasesAsync(IndicesAliasesRequest, RequestOptions, ActionListener)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void updateAliasesAsync(IndicesAliasesRequest indicesAliasesRequest, ActionListener<IndicesAliasesResponse> listener,
|
||||
Header... headers) {
|
||||
restHighLevelClient.performRequestAsyncAndParseEntity(indicesAliasesRequest, RequestConverters::updateAliases,
|
||||
IndicesAliasesResponse::fromXContent, listener, emptySet(), headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens an index using the Open Index API.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-open-close.html">
|
||||
|
@ -337,19 +228,6 @@ public final class IndicesClient {
|
|||
OpenIndexResponse::fromXContent, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens an index using the Open Index API.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-open-close.html">
|
||||
* Open Index API on elastic.co</a>
|
||||
* @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.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-open-close.html">
|
||||
|
@ -363,19 +241,6 @@ public final class IndicesClient {
|
|||
OpenIndexResponse::fromXContent, listener, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously opens an index using the Open Index API.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-open-close.html">
|
||||
* Open Index API on elastic.co</a>
|
||||
* @deprecated Prefer {@link #openAsync(OpenIndexRequest, RequestOptions, ActionListener)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void openAsync(OpenIndexRequest openIndexRequest, ActionListener<OpenIndexResponse> listener, Header... headers) {
|
||||
restHighLevelClient.performRequestAsyncAndParseEntity(openIndexRequest, RequestConverters::openIndex,
|
||||
OpenIndexResponse::fromXContent, listener, emptySet(), headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes an index using the Close Index API.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-open-close.html">
|
||||
|
@ -390,19 +255,6 @@ public final class IndicesClient {
|
|||
CloseIndexResponse::fromXContent, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes an index using the Close Index API.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-open-close.html">
|
||||
* Close Index API on elastic.co</a>
|
||||
* @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.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-open-close.html">
|
||||
|
@ -417,19 +269,6 @@ public final class IndicesClient {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Asynchronously closes an index using the Close Index API.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-open-close.html">
|
||||
* Close Index API on elastic.co</a>
|
||||
* @deprecated Prefer {@link #closeAsync(CloseIndexRequest, RequestOptions, ActionListener)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void closeAsync(CloseIndexRequest closeIndexRequest, ActionListener<CloseIndexResponse> 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.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html">
|
||||
|
@ -444,19 +283,6 @@ public final class IndicesClient {
|
|||
RestHighLevelClient::convertExistsResponse, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if one or more aliases exist using the Aliases Exist API.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html">
|
||||
* Indices Aliases API on elastic.co</a>
|
||||
* @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.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html">
|
||||
|
@ -470,19 +296,6 @@ public final class IndicesClient {
|
|||
RestHighLevelClient::convertExistsResponse, listener, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously checks if one or more aliases exist using the Aliases Exist API.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html">
|
||||
* Indices Aliases API on elastic.co</a>
|
||||
* @deprecated Prefer {@link #existsAliasAsync(GetAliasesRequest, RequestOptions, ActionListener)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void existsAliasAsync(GetAliasesRequest getAliasesRequest, ActionListener<Boolean> listener, Header... headers) {
|
||||
restHighLevelClient.performRequestAsync(getAliasesRequest, RequestConverters::existsAlias,
|
||||
RestHighLevelClient::convertExistsResponse, listener, emptySet(), headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh one or more indices using the Refresh API.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-refresh.html"> Refresh API on elastic.co</a>
|
||||
|
@ -496,18 +309,6 @@ public final class IndicesClient {
|
|||
RefreshResponse::fromXContent, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh one or more indices using the Refresh API.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-refresh.html"> Refresh API on elastic.co</a>
|
||||
* @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.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-refresh.html"> Refresh API on elastic.co</a>
|
||||
|
@ -520,18 +321,6 @@ public final class IndicesClient {
|
|||
RefreshResponse::fromXContent, listener, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously refresh one or more indices using the Refresh API.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-refresh.html"> Refresh API on elastic.co</a>
|
||||
* @deprecated Prefer {@link #refreshAsync(RefreshRequest, RequestOptions, ActionListener)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void refreshAsync(RefreshRequest refreshRequest, ActionListener<RefreshResponse> listener, Header... headers) {
|
||||
restHighLevelClient.performRequestAsyncAndParseEntity(refreshRequest, RequestConverters::refresh, RefreshResponse::fromXContent,
|
||||
listener, emptySet(), headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush one or more indices using the Flush API.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-flush.html"> Flush API on elastic.co</a>
|
||||
|
@ -545,18 +334,6 @@ public final class IndicesClient {
|
|||
FlushResponse::fromXContent, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush one or more indices using the Flush API.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-flush.html"> Flush API on elastic.co</a>
|
||||
* @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.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-flush.html"> Flush API on elastic.co</a>
|
||||
|
@ -569,18 +346,6 @@ public final class IndicesClient {
|
|||
FlushResponse::fromXContent, listener, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously flush one or more indices using the Flush API.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-flush.html"> Flush API on elastic.co</a>
|
||||
* @deprecated Prefer {@link #flushAsync(FlushRequest, RequestOptions, ActionListener)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void flushAsync(FlushRequest flushRequest, ActionListener<FlushResponse> listener, Header... headers) {
|
||||
restHighLevelClient.performRequestAsyncAndParseEntity(flushRequest, RequestConverters::flush, FlushResponse::fromXContent,
|
||||
listener, emptySet(), headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiate a synced flush manually using the synced flush API.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-synced-flush.html">
|
||||
|
@ -651,19 +416,6 @@ public final class IndicesClient {
|
|||
ForceMergeResponse::fromXContent, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Force merge one or more indices using the Force Merge API.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-forcemerge.html">
|
||||
* Force Merge API on elastic.co</a>
|
||||
* @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.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-forcemerge.html">
|
||||
|
@ -677,19 +429,6 @@ public final class IndicesClient {
|
|||
ForceMergeResponse::fromXContent, listener, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously force merge one or more indices using the Force Merge API.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-forcemerge.html">
|
||||
* Force Merge API on elastic.co</a>
|
||||
* @deprecated Prefer {@link #forceMergeAsync(ForceMergeRequest, RequestOptions, ActionListener)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void forceMergeAsync(ForceMergeRequest forceMergeRequest, ActionListener<ForceMergeResponse> 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.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-clearcache.html">
|
||||
|
@ -705,19 +444,6 @@ public final class IndicesClient {
|
|||
ClearIndicesCacheResponse::fromXContent, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the cache of one or more indices using the Clear Cache API.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-clearcache.html">
|
||||
* Clear Cache API on elastic.co</a>
|
||||
* @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.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-clearcache.html">
|
||||
|
@ -732,20 +458,6 @@ public final class IndicesClient {
|
|||
ClearIndicesCacheResponse::fromXContent, listener, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously clears the cache of one or more indices using the Clear Cache API.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-clearcache.html">
|
||||
* Clear Cache API on elastic.co</a>
|
||||
* @deprecated Prefer {@link #clearCacheAsync(ClearIndicesCacheRequest, RequestOptions, ActionListener)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void clearCacheAsync(ClearIndicesCacheRequest clearIndicesCacheRequest, ActionListener<ClearIndicesCacheResponse> listener,
|
||||
Header... headers) {
|
||||
restHighLevelClient.performRequestAsyncAndParseEntity(clearIndicesCacheRequest, RequestConverters::clearCache,
|
||||
ClearIndicesCacheResponse::fromXContent, listener, emptySet(), headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the index (indices) exists or not.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-exists.html">
|
||||
|
@ -765,24 +477,6 @@ public final class IndicesClient {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the index (indices) exists or not.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-exists.html">
|
||||
* Indices Exists API on elastic.co</a>
|
||||
* @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 <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-exists.html">
|
||||
|
@ -802,25 +496,6 @@ public final class IndicesClient {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously checks if the index (indices) exists or not.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-exists.html">
|
||||
* Indices Exists API on elastic.co</a>
|
||||
* @deprecated Prefer {@link #existsAsync(GetIndexRequest, RequestOptions, ActionListener)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void existsAsync(GetIndexRequest request, ActionListener<Boolean> listener, Header... headers) {
|
||||
restHighLevelClient.performRequestAsync(
|
||||
request,
|
||||
RequestConverters::indicesExist,
|
||||
RestHighLevelClient::convertExistsResponse,
|
||||
listener,
|
||||
Collections.emptySet(),
|
||||
headers
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shrinks an index using the Shrink Index API.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-shrink-index.html">
|
||||
|
@ -835,19 +510,6 @@ public final class IndicesClient {
|
|||
ResizeResponse::fromXContent, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Shrinks an index using the Shrink Index API.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-shrink-index.html">
|
||||
* Shrink Index API on elastic.co</a>
|
||||
* @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.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-shrink-index.html">
|
||||
|
@ -861,19 +523,6 @@ public final class IndicesClient {
|
|||
ResizeResponse::fromXContent, listener, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously shrinks an index using the Shrink index API.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-shrink-index.html">
|
||||
* Shrink Index API on elastic.co</a>
|
||||
* @deprecated Prefer {@link #shrinkAsync(ResizeRequest, RequestOptions, ActionListener)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void shrinkAsync(ResizeRequest resizeRequest, ActionListener<ResizeResponse> listener, Header... headers) {
|
||||
restHighLevelClient.performRequestAsyncAndParseEntity(resizeRequest, RequestConverters::shrink, ResizeResponse::fromXContent,
|
||||
listener, emptySet(), headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Splits an index using the Split Index API.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-split-index.html">
|
||||
|
@ -888,19 +537,6 @@ public final class IndicesClient {
|
|||
ResizeResponse::fromXContent, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Splits an index using the Split Index API.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-split-index.html">
|
||||
* Split Index API on elastic.co</a>
|
||||
* @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.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-split-index.html">
|
||||
|
@ -914,19 +550,6 @@ public final class IndicesClient {
|
|||
ResizeResponse::fromXContent, listener, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously splits an index using the Split Index API.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-split-index.html">
|
||||
* Split Index API on elastic.co</a>
|
||||
* @deprecated Prefer {@link #splitAsync(ResizeRequest, RequestOptions, ActionListener)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void splitAsync(ResizeRequest resizeRequest, ActionListener<ResizeResponse> listener, Header... headers) {
|
||||
restHighLevelClient.performRequestAsyncAndParseEntity(resizeRequest, RequestConverters::split, ResizeResponse::fromXContent,
|
||||
listener, emptySet(), headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rolls over an index using the Rollover Index API.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-rollover-index.html">
|
||||
|
@ -941,19 +564,6 @@ public final class IndicesClient {
|
|||
RolloverResponse::fromXContent, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Rolls over an index using the Rollover Index API.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-rollover-index.html">
|
||||
* Rollover Index API on elastic.co</a>
|
||||
* @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.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-rollover-index.html">
|
||||
|
@ -967,19 +577,6 @@ public final class IndicesClient {
|
|||
RolloverResponse::fromXContent, listener, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously rolls over an index using the Rollover Index API.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-rollover-index.html">
|
||||
* Rollover Index API on elastic.co</a>
|
||||
* @deprecated Prefer {@link #rolloverAsync(RolloverRequest, RequestOptions, ActionListener)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void rolloverAsync(RolloverRequest rolloverRequest, ActionListener<RolloverResponse> listener, Header... headers) {
|
||||
restHighLevelClient.performRequestAsyncAndParseEntity(rolloverRequest, RequestConverters::rollover, RolloverResponse::fromXContent,
|
||||
listener, emptySet(), headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets one or more aliases using the Get Index Aliases API.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html"> Indices Aliases API on
|
||||
|
@ -1021,19 +618,6 @@ public final class IndicesClient {
|
|||
UpdateSettingsResponse::fromXContent, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates specific index level settings using the Update Indices Settings API.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-update-settings.html"> Update Indices Settings
|
||||
* API on elastic.co</a>
|
||||
* @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.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-update-settings.html"> Update Indices Settings
|
||||
|
@ -1048,20 +632,6 @@ public final class IndicesClient {
|
|||
UpdateSettingsResponse::fromXContent, listener, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously updates specific index level settings using the Update Indices Settings API.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-update-settings.html"> Update Indices Settings
|
||||
* API on elastic.co</a>
|
||||
* @deprecated Prefer {@link #putSettingsAsync(UpdateSettingsRequest, RequestOptions, ActionListener)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void putSettingsAsync(UpdateSettingsRequest updateSettingsRequest, ActionListener<UpdateSettingsResponse> listener,
|
||||
Header... headers) {
|
||||
restHighLevelClient.performRequestAsyncAndParseEntity(updateSettingsRequest, RequestConverters::indexPutSettings,
|
||||
UpdateSettingsResponse::fromXContent, listener, emptySet(), headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts an index template using the Index Templates API.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
|
||||
|
|
|
@ -296,17 +296,6 @@ public class RestHighLevelClient implements Closeable {
|
|||
return performRequestAndParseEntity(bulkRequest, RequestConverters::bulk, options, BulkResponse::fromXContent, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a bulk request using the Bulk API.
|
||||
*
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html">Bulk API on elastic.co</a>
|
||||
* @deprecated Prefer {@link #bulk(BulkRequest, RequestOptions)}
|
||||
*/
|
||||
@Deprecated
|
||||
public final BulkResponse bulk(BulkRequest bulkRequest, Header... headers) throws IOException {
|
||||
return performRequestAndParseEntity(bulkRequest, RequestConverters::bulk, BulkResponse::fromXContent, emptySet(), headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously executes a bulk request using the Bulk API.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html">Bulk API on elastic.co</a>
|
||||
|
@ -318,17 +307,6 @@ public class RestHighLevelClient implements Closeable {
|
|||
performRequestAsyncAndParseEntity(bulkRequest, RequestConverters::bulk, options, BulkResponse::fromXContent, listener, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously executes a bulk request using the Bulk API.
|
||||
*
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html">Bulk API on elastic.co</a>
|
||||
* @deprecated Prefer {@link #bulkAsync(BulkRequest, RequestOptions, ActionListener)}
|
||||
*/
|
||||
@Deprecated
|
||||
public final void bulkAsync(BulkRequest bulkRequest, ActionListener<BulkResponse> listener, Header... headers) {
|
||||
performRequestAsyncAndParseEntity(bulkRequest, RequestConverters::bulk, BulkResponse::fromXContent, listener, emptySet(), headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pings the remote Elasticsearch cluster and returns true if the ping succeeded, false otherwise
|
||||
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
|
||||
|
@ -340,16 +318,6 @@ public class RestHighLevelClient implements Closeable {
|
|||
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
|
||||
|
@ -361,16 +329,6 @@ public class RestHighLevelClient implements Closeable {
|
|||
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.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html">Get API on elastic.co</a>
|
||||
|
@ -383,17 +341,6 @@ public class RestHighLevelClient implements Closeable {
|
|||
return performRequestAndParseEntity(getRequest, RequestConverters::get, options, GetResponse::fromXContent, singleton(404));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a document by id using the Get API.
|
||||
*
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html">Get API on elastic.co</a>
|
||||
* @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.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html">Get API on elastic.co</a>
|
||||
|
@ -406,18 +353,6 @@ public class RestHighLevelClient implements Closeable {
|
|||
singleton(404));
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously retrieves a document by id using the Get API.
|
||||
*
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html">Get API on elastic.co</a>
|
||||
* @deprecated Prefer {@link #getAsync(GetRequest, RequestOptions, ActionListener)}
|
||||
*/
|
||||
@Deprecated
|
||||
public final void getAsync(GetRequest getRequest, ActionListener<GetResponse> listener, Header... headers) {
|
||||
performRequestAsyncAndParseEntity(getRequest, RequestConverters::get, GetResponse::fromXContent, listener,
|
||||
singleton(404), headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves multiple documents by id using the Multi Get API.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html">Multi Get API on elastic.co</a>
|
||||
|
@ -431,18 +366,6 @@ public class RestHighLevelClient implements Closeable {
|
|||
singleton(404));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves multiple documents by id using the Multi Get API.
|
||||
*
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html">Multi Get API on elastic.co</a>
|
||||
* @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.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html">Multi Get API on elastic.co</a>
|
||||
|
@ -455,18 +378,6 @@ public class RestHighLevelClient implements Closeable {
|
|||
singleton(404));
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously retrieves multiple documents by id using the Multi Get API.
|
||||
*
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html">Multi Get API on elastic.co</a>
|
||||
* @deprecated Prefer {@link #multiGetAsync(MultiGetRequest, RequestOptions, ActionListener)}
|
||||
*/
|
||||
@Deprecated
|
||||
public final void multiGetAsync(MultiGetRequest multiGetRequest, ActionListener<MultiGetResponse> 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.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html">Get API on elastic.co</a>
|
||||
|
@ -479,17 +390,6 @@ public class RestHighLevelClient implements Closeable {
|
|||
return performRequest(getRequest, RequestConverters::exists, options, RestHighLevelClient::convertExistsResponse, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for the existence of a document. Returns true if it exists, false otherwise.
|
||||
*
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html">Get API on elastic.co</a>
|
||||
* @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.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html">Get API on elastic.co</a>
|
||||
|
@ -502,18 +402,6 @@ public class RestHighLevelClient implements Closeable {
|
|||
emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously checks for the existence of a document. Returns true if it exists, false otherwise.
|
||||
*
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html">Get API on elastic.co</a>
|
||||
* @deprecated Prefer {@link #existsAsync(GetRequest, RequestOptions, ActionListener)}
|
||||
*/
|
||||
@Deprecated
|
||||
public final void existsAsync(GetRequest getRequest, ActionListener<Boolean> listener, Header... headers) {
|
||||
performRequestAsync(getRequest, RequestConverters::exists, RestHighLevelClient::convertExistsResponse, listener,
|
||||
emptySet(), headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Index a document using the Index API.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html">Index API on elastic.co</a>
|
||||
|
@ -526,17 +414,6 @@ public class RestHighLevelClient implements Closeable {
|
|||
return performRequestAndParseEntity(indexRequest, RequestConverters::index, options, IndexResponse::fromXContent, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Index a document using the Index API.
|
||||
*
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html">Index API on elastic.co</a>
|
||||
* @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.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html">Index API on elastic.co</a>
|
||||
|
@ -549,18 +426,6 @@ public class RestHighLevelClient implements Closeable {
|
|||
emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously index a document using the Index API.
|
||||
*
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html">Index API on elastic.co</a>
|
||||
* @deprecated Prefer {@link #indexAsync(IndexRequest, RequestOptions, ActionListener)}
|
||||
*/
|
||||
@Deprecated
|
||||
public final void indexAsync(IndexRequest indexRequest, ActionListener<IndexResponse> listener, Header... headers) {
|
||||
performRequestAsyncAndParseEntity(indexRequest, RequestConverters::index, IndexResponse::fromXContent, listener,
|
||||
emptySet(), headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a document using the Update API.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html">Update API on elastic.co</a>
|
||||
|
@ -573,17 +438,6 @@ public class RestHighLevelClient implements Closeable {
|
|||
return performRequestAndParseEntity(updateRequest, RequestConverters::update, options, UpdateResponse::fromXContent, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a document using the Update API.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html">Update API on elastic.co</a>
|
||||
* @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.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html">Update API on elastic.co</a>
|
||||
|
@ -596,18 +450,6 @@ public class RestHighLevelClient implements Closeable {
|
|||
emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously updates a document using the Update API.
|
||||
* <p>
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html">Update API on elastic.co</a>
|
||||
* @deprecated Prefer {@link #updateAsync(UpdateRequest, RequestOptions, ActionListener)}
|
||||
*/
|
||||
@Deprecated
|
||||
public final void updateAsync(UpdateRequest updateRequest, ActionListener<UpdateResponse> listener, Header... headers) {
|
||||
performRequestAsyncAndParseEntity(updateRequest, RequestConverters::update, UpdateResponse::fromXContent, listener,
|
||||
emptySet(), headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a document by id using the Delete API.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html">Delete API on elastic.co</a>
|
||||
|
@ -621,18 +463,6 @@ public class RestHighLevelClient implements Closeable {
|
|||
singleton(404));
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a document by id using the Delete API.
|
||||
*
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html">Delete API on elastic.co</a>
|
||||
* @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.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html">Delete API on elastic.co</a>
|
||||
|
@ -645,18 +475,6 @@ public class RestHighLevelClient implements Closeable {
|
|||
Collections.singleton(404));
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously deletes a document by id using the Delete API.
|
||||
*
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html">Delete API on elastic.co</a>
|
||||
* @deprecated Prefer {@link #deleteAsync(DeleteRequest, RequestOptions, ActionListener)}
|
||||
*/
|
||||
@Deprecated
|
||||
public final void deleteAsync(DeleteRequest deleteRequest, ActionListener<DeleteResponse> listener, Header... headers) {
|
||||
performRequestAsyncAndParseEntity(deleteRequest, RequestConverters::delete, DeleteResponse::fromXContent, listener,
|
||||
Collections.singleton(404), headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a search request using the Search API.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html">Search API on elastic.co</a>
|
||||
|
@ -669,17 +487,6 @@ public class RestHighLevelClient implements Closeable {
|
|||
return performRequestAndParseEntity(searchRequest, RequestConverters::search, options, SearchResponse::fromXContent, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a search using the Search API.
|
||||
*
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html">Search API on elastic.co</a>
|
||||
* @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.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html">Search API on elastic.co</a>
|
||||
|
@ -692,18 +499,6 @@ public class RestHighLevelClient implements Closeable {
|
|||
emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously executes a search using the Search API.
|
||||
*
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html">Search API on elastic.co</a>
|
||||
* @deprecated Prefer {@link #searchAsync(SearchRequest, RequestOptions, ActionListener)}
|
||||
*/
|
||||
@Deprecated
|
||||
public final void searchAsync(SearchRequest searchRequest, ActionListener<SearchResponse> listener, Header... headers) {
|
||||
performRequestAsyncAndParseEntity(searchRequest, RequestConverters::search, SearchResponse::fromXContent, listener,
|
||||
emptySet(), headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a multi search using the msearch API.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html">Multi search API on
|
||||
|
@ -718,19 +513,6 @@ public class RestHighLevelClient implements Closeable {
|
|||
emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a multi search using the msearch API.
|
||||
*
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html">Multi search API on
|
||||
* elastic.co</a>
|
||||
* @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.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html">Multi search API on
|
||||
|
@ -745,19 +527,6 @@ public class RestHighLevelClient implements Closeable {
|
|||
listener, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously executes a multi search using the msearch API.
|
||||
*
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html">Multi search API on
|
||||
* elastic.co</a>
|
||||
* @deprecated Prefer {@link #multiSearchAsync(MultiSearchRequest, RequestOptions, ActionListener)}
|
||||
*/
|
||||
@Deprecated
|
||||
public final void multiSearchAsync(MultiSearchRequest searchRequest, ActionListener<MultiSearchResponse> listener, Header... headers) {
|
||||
performRequestAsyncAndParseEntity(searchRequest, RequestConverters::multiSearch, MultiSearchResponse::fromXContext, listener,
|
||||
emptySet(), headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a search using the Search Scroll API.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html">Search Scroll
|
||||
|
@ -772,19 +541,6 @@ public class RestHighLevelClient implements Closeable {
|
|||
emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a search using the Search Scroll API.
|
||||
*
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html">Search Scroll
|
||||
* API on elastic.co</a>
|
||||
* @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.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html">Search Scroll
|
||||
|
@ -799,20 +555,6 @@ public class RestHighLevelClient implements Closeable {
|
|||
listener, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously executes a search using the Search Scroll API.
|
||||
*
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html">Search Scroll
|
||||
* API on elastic.co</a>
|
||||
* @deprecated Prefer {@link #searchScrollAsync(SearchScrollRequest, RequestOptions, ActionListener)}
|
||||
*/
|
||||
@Deprecated
|
||||
public final void searchScrollAsync(SearchScrollRequest searchScrollRequest,
|
||||
ActionListener<SearchResponse> listener, Header... headers) {
|
||||
performRequestAsyncAndParseEntity(searchScrollRequest, RequestConverters::searchScroll, SearchResponse::fromXContent,
|
||||
listener, emptySet(), headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears one or more scroll ids using the Clear Scroll API.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html#_clear_scroll_api">
|
||||
|
@ -827,19 +569,6 @@ public class RestHighLevelClient implements Closeable {
|
|||
emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears one or more scroll ids using the Clear Scroll API.
|
||||
*
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html#_clear_scroll_api">
|
||||
* Clear Scroll API on elastic.co</a>
|
||||
* @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.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html#_clear_scroll_api">
|
||||
|
@ -854,20 +583,6 @@ public class RestHighLevelClient implements Closeable {
|
|||
listener, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously clears one or more scroll ids using the Clear Scroll API.
|
||||
*
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html#_clear_scroll_api">
|
||||
* Clear Scroll API on elastic.co</a>
|
||||
* @deprecated Prefer {@link #clearScrollAsync(ClearScrollRequest, RequestOptions, ActionListener)}
|
||||
*/
|
||||
@Deprecated
|
||||
public final void clearScrollAsync(ClearScrollRequest clearScrollRequest,
|
||||
ActionListener<ClearScrollResponse> listener, Header... headers) {
|
||||
performRequestAsyncAndParseEntity(clearScrollRequest, RequestConverters::clearScroll, ClearScrollResponse::fromXContent,
|
||||
listener, emptySet(), headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a request using the Search Template API.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html">Search Template API
|
||||
|
@ -909,19 +624,6 @@ public class RestHighLevelClient implements Closeable {
|
|||
emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a request using the Ranking Evaluation API.
|
||||
*
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-rank-eval.html">Ranking Evaluation API
|
||||
* on elastic.co</a>
|
||||
* @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 <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-rank-eval.html">Ranking Evaluation API
|
||||
|
@ -935,19 +637,6 @@ public class RestHighLevelClient implements Closeable {
|
|||
emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously executes a request using the Ranking Evaluation API.
|
||||
*
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-rank-eval.html">Ranking Evaluation API
|
||||
* on elastic.co</a>
|
||||
* @deprecated Prefer {@link #rankEvalAsync(RankEvalRequest, RequestOptions, ActionListener)}
|
||||
*/
|
||||
@Deprecated
|
||||
public final void rankEvalAsync(RankEvalRequest rankEvalRequest, ActionListener<RankEvalResponse> listener, Header... headers) {
|
||||
performRequestAsyncAndParseEntity(rankEvalRequest, RequestConverters::rankEval, RankEvalResponse::fromXContent, listener,
|
||||
emptySet(), headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a request using the Field Capabilities API.
|
||||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-field-caps.html">Field Capabilities API
|
||||
|
@ -977,14 +666,6 @@ public class RestHighLevelClient implements Closeable {
|
|||
FieldCapabilitiesResponse::fromXContent, listener, emptySet());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
protected final <Req extends ActionRequest, Resp> Resp performRequestAndParseEntity(Req request,
|
||||
CheckedFunction<Req, Request, IOException> requestConverter,
|
||||
CheckedFunction<XContentParser, Resp, IOException> entityParser,
|
||||
Set<Integer> ignores, Header... headers) throws IOException {
|
||||
return performRequest(request, requestConverter, (response) -> parseEntity(response.getEntity(), entityParser), ignores, headers);
|
||||
}
|
||||
|
||||
protected final <Req extends ActionRequest, Resp> Resp performRequestAndParseEntity(Req request,
|
||||
CheckedFunction<Req, Request, IOException> requestConverter,
|
||||
RequestOptions options,
|
||||
|
@ -994,14 +675,6 @@ public class RestHighLevelClient implements Closeable {
|
|||
response -> parseEntity(response.getEntity(), entityParser), ignores);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
protected final <Req extends ActionRequest, Resp> Resp performRequest(Req request,
|
||||
CheckedFunction<Req, Request, IOException> requestConverter,
|
||||
CheckedFunction<Response, Resp, IOException> responseConverter,
|
||||
Set<Integer> ignores, Header... headers) throws IOException {
|
||||
return performRequest(request, requestConverter, optionsForHeaders(headers), responseConverter, ignores);
|
||||
}
|
||||
|
||||
protected final <Req extends ActionRequest, Resp> Resp performRequest(Req request,
|
||||
CheckedFunction<Req, Request, IOException> requestConverter,
|
||||
RequestOptions options,
|
||||
|
@ -1038,15 +711,6 @@ public class RestHighLevelClient implements Closeable {
|
|||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
protected final <Req extends ActionRequest, Resp> void performRequestAsyncAndParseEntity(Req request,
|
||||
CheckedFunction<Req, Request, IOException> requestConverter,
|
||||
CheckedFunction<XContentParser, Resp, IOException> entityParser,
|
||||
ActionListener<Resp> listener, Set<Integer> ignores, Header... headers) {
|
||||
performRequestAsync(request, requestConverter, (response) -> parseEntity(response.getEntity(), entityParser),
|
||||
listener, ignores, headers);
|
||||
}
|
||||
|
||||
protected final <Req extends ActionRequest, Resp> void performRequestAsyncAndParseEntity(Req request,
|
||||
CheckedFunction<Req, Request, IOException> requestConverter,
|
||||
RequestOptions options,
|
||||
|
@ -1056,14 +720,6 @@ public class RestHighLevelClient implements Closeable {
|
|||
response -> parseEntity(response.getEntity(), entityParser), listener, ignores);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
protected final <Req extends ActionRequest, Resp> void performRequestAsync(Req request,
|
||||
CheckedFunction<Req, Request, IOException> requestConverter,
|
||||
CheckedFunction<Response, Resp, IOException> responseConverter,
|
||||
ActionListener<Resp> listener, Set<Integer> ignores, Header... headers) {
|
||||
performRequestAsync(request, requestConverter, optionsForHeaders(headers), responseConverter, listener, ignores);
|
||||
}
|
||||
|
||||
protected final <Req extends ActionRequest, Resp> void performRequestAsync(Req request,
|
||||
CheckedFunction<Req, Request, IOException> requestConverter,
|
||||
RequestOptions options,
|
||||
|
|
|
@ -84,7 +84,7 @@ public final class TasksClient {
|
|||
cancelTasksRequest,
|
||||
RequestConverters::cancelTasks,
|
||||
options,
|
||||
parser -> CancelTasksResponse.fromXContent(parser),
|
||||
CancelTasksResponse::fromXContent,
|
||||
emptySet()
|
||||
);
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ public final class TasksClient {
|
|||
cancelTasksRequest,
|
||||
RequestConverters::cancelTasks,
|
||||
options,
|
||||
parser -> CancelTasksResponse.fromXContent(parser),
|
||||
CancelTasksResponse::fromXContent,
|
||||
listener,
|
||||
emptySet()
|
||||
);
|
||||
|
|
|
@ -56,7 +56,8 @@ import static org.hamcrest.Matchers.lessThanOrEqualTo;
|
|||
public class BulkProcessorIT extends ESRestHighLevelClientTestCase {
|
||||
|
||||
private static BulkProcessor.Builder initBulkProcessorBuilder(BulkProcessor.Listener listener) {
|
||||
return BulkProcessor.builder(highLevelClient()::bulkAsync, listener);
|
||||
return BulkProcessor.builder(
|
||||
(request, bulkListener) -> highLevelClient().bulkAsync(request, RequestOptions.DEFAULT, bulkListener), listener);
|
||||
}
|
||||
|
||||
public void testThatBulkProcessorCountIsCorrect() throws Exception {
|
||||
|
|
|
@ -48,7 +48,8 @@ public class BulkProcessorRetryIT extends ESRestHighLevelClientTestCase {
|
|||
private static final String TYPE_NAME = "type";
|
||||
|
||||
private static BulkProcessor.Builder initBulkProcessorBuilder(BulkProcessor.Listener listener) {
|
||||
return BulkProcessor.builder(highLevelClient()::bulkAsync, listener);
|
||||
return BulkProcessor.builder(
|
||||
(request, bulkListener) -> highLevelClient().bulkAsync(request, RequestOptions.DEFAULT, bulkListener), listener);
|
||||
}
|
||||
|
||||
public void testBulkRejectionLoadWithoutBackoff() throws Exception {
|
||||
|
|
|
@ -63,7 +63,6 @@ public class ClusterClientIT extends ESRestHighLevelClientTestCase {
|
|||
setRequest.persistentSettings(map);
|
||||
|
||||
ClusterUpdateSettingsResponse setResponse = execute(setRequest, highLevelClient().cluster()::putSettings,
|
||||
highLevelClient().cluster()::putSettingsAsync, highLevelClient().cluster()::putSettings,
|
||||
highLevelClient().cluster()::putSettingsAsync);
|
||||
|
||||
assertAcked(setResponse);
|
||||
|
@ -86,7 +85,6 @@ public class ClusterClientIT extends ESRestHighLevelClientTestCase {
|
|||
resetRequest.persistentSettings("{\"" + persistentSettingKey + "\": null }", XContentType.JSON);
|
||||
|
||||
ClusterUpdateSettingsResponse resetResponse = execute(resetRequest, highLevelClient().cluster()::putSettings,
|
||||
highLevelClient().cluster()::putSettingsAsync, highLevelClient().cluster()::putSettings,
|
||||
highLevelClient().cluster()::putSettingsAsync);
|
||||
|
||||
assertThat(resetResponse.getTransientSettings().get(transientSettingKey), equalTo(null));
|
||||
|
@ -108,7 +106,6 @@ public class ClusterClientIT extends ESRestHighLevelClientTestCase {
|
|||
clusterUpdateSettingsRequest.transientSettings(Settings.builder().put(setting, value).build());
|
||||
|
||||
ElasticsearchException exception = expectThrows(ElasticsearchException.class, () -> execute(clusterUpdateSettingsRequest,
|
||||
highLevelClient().cluster()::putSettings, highLevelClient().cluster()::putSettingsAsync,
|
||||
highLevelClient().cluster()::putSettings, highLevelClient().cluster()::putSettingsAsync));
|
||||
assertThat(exception.status(), equalTo(RestStatus.BAD_REQUEST));
|
||||
assertThat(exception.getMessage(), equalTo(
|
||||
|
|
|
@ -74,8 +74,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
if (randomBoolean()) {
|
||||
deleteRequest.version(1L);
|
||||
}
|
||||
DeleteResponse deleteResponse = execute(deleteRequest, highLevelClient()::delete, highLevelClient()::deleteAsync,
|
||||
highLevelClient()::delete, highLevelClient()::deleteAsync);
|
||||
DeleteResponse deleteResponse = execute(deleteRequest, highLevelClient()::delete, highLevelClient()::deleteAsync);
|
||||
assertEquals("index", deleteResponse.getIndex());
|
||||
assertEquals("type", deleteResponse.getType());
|
||||
assertEquals(docId, deleteResponse.getId());
|
||||
|
@ -85,8 +84,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
// Testing non existing document
|
||||
String docId = "does_not_exist";
|
||||
DeleteRequest deleteRequest = new DeleteRequest("index", "type", docId);
|
||||
DeleteResponse deleteResponse = execute(deleteRequest, highLevelClient()::delete, highLevelClient()::deleteAsync,
|
||||
highLevelClient()::delete, highLevelClient()::deleteAsync);
|
||||
DeleteResponse deleteResponse = execute(deleteRequest, highLevelClient()::delete, highLevelClient()::deleteAsync);
|
||||
assertEquals("index", deleteResponse.getIndex());
|
||||
assertEquals("type", deleteResponse.getType());
|
||||
assertEquals(docId, deleteResponse.getId());
|
||||
|
@ -99,8 +97,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
new IndexRequest("index", "type", docId).source(Collections.singletonMap("foo", "bar")), RequestOptions.DEFAULT);
|
||||
DeleteRequest deleteRequest = new DeleteRequest("index", "type", docId).version(2);
|
||||
ElasticsearchException exception = expectThrows(ElasticsearchException.class,
|
||||
() -> execute(deleteRequest, highLevelClient()::delete, highLevelClient()::deleteAsync,
|
||||
highLevelClient()::delete, highLevelClient()::deleteAsync));
|
||||
() -> execute(deleteRequest, highLevelClient()::delete, highLevelClient()::deleteAsync));
|
||||
assertEquals(RestStatus.CONFLICT, exception.status());
|
||||
assertEquals("Elasticsearch exception [type=version_conflict_engine_exception, reason=[type][" + docId + "]: " +
|
||||
"version conflict, current version [1] is different than the one provided [2]]", exception.getMessage());
|
||||
|
@ -113,8 +110,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
new IndexRequest("index", "type", docId).source(Collections.singletonMap("foo", "bar"))
|
||||
.versionType(VersionType.EXTERNAL).version(12), RequestOptions.DEFAULT);
|
||||
DeleteRequest deleteRequest = new DeleteRequest("index", "type", docId).versionType(VersionType.EXTERNAL).version(13);
|
||||
DeleteResponse deleteResponse = execute(deleteRequest, highLevelClient()::delete, highLevelClient()::deleteAsync,
|
||||
highLevelClient()::delete, highLevelClient()::deleteAsync);
|
||||
DeleteResponse deleteResponse = execute(deleteRequest, highLevelClient()::delete, highLevelClient()::deleteAsync);
|
||||
assertEquals("index", deleteResponse.getIndex());
|
||||
assertEquals("type", deleteResponse.getType());
|
||||
assertEquals(docId, deleteResponse.getId());
|
||||
|
@ -128,8 +124,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
.versionType(VersionType.EXTERNAL).version(12), RequestOptions.DEFAULT);
|
||||
ElasticsearchStatusException exception = expectThrows(ElasticsearchStatusException.class, () -> {
|
||||
DeleteRequest deleteRequest = new DeleteRequest("index", "type", docId).versionType(VersionType.EXTERNAL).version(10);
|
||||
execute(deleteRequest, highLevelClient()::delete, highLevelClient()::deleteAsync,
|
||||
highLevelClient()::delete, highLevelClient()::deleteAsync);
|
||||
execute(deleteRequest, highLevelClient()::delete, highLevelClient()::deleteAsync);
|
||||
});
|
||||
assertEquals(RestStatus.CONFLICT, exception.status());
|
||||
assertEquals("Elasticsearch exception [type=version_conflict_engine_exception, reason=[type][" +
|
||||
|
@ -142,8 +137,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
highLevelClient().index(new IndexRequest("index", "type", docId).source(Collections.singletonMap("foo", "bar")).routing("foo"),
|
||||
RequestOptions.DEFAULT);
|
||||
DeleteRequest deleteRequest = new DeleteRequest("index", "type", docId).routing("foo");
|
||||
DeleteResponse deleteResponse = execute(deleteRequest, highLevelClient()::delete, highLevelClient()::deleteAsync,
|
||||
highLevelClient()::delete, highLevelClient()::deleteAsync);
|
||||
DeleteResponse deleteResponse = execute(deleteRequest, highLevelClient()::delete, highLevelClient()::deleteAsync);
|
||||
assertEquals("index", deleteResponse.getIndex());
|
||||
assertEquals("type", deleteResponse.getType());
|
||||
assertEquals(docId, deleteResponse.getId());
|
||||
|
@ -154,8 +148,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
public void testExists() throws IOException {
|
||||
{
|
||||
GetRequest getRequest = new GetRequest("index", "type", "id");
|
||||
assertFalse(execute(getRequest, highLevelClient()::exists, highLevelClient()::existsAsync,
|
||||
highLevelClient()::exists, highLevelClient()::existsAsync));
|
||||
assertFalse(execute(getRequest, highLevelClient()::exists, highLevelClient()::existsAsync));
|
||||
}
|
||||
IndexRequest index = new IndexRequest("index", "type", "id");
|
||||
index.source("{\"field1\":\"value1\",\"field2\":\"value2\"}", XContentType.JSON);
|
||||
|
@ -163,18 +156,15 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
highLevelClient().index(index, RequestOptions.DEFAULT);
|
||||
{
|
||||
GetRequest getRequest = new GetRequest("index", "type", "id");
|
||||
assertTrue(execute(getRequest, highLevelClient()::exists, highLevelClient()::existsAsync,
|
||||
highLevelClient()::exists, highLevelClient()::existsAsync));
|
||||
assertTrue(execute(getRequest, highLevelClient()::exists, highLevelClient()::existsAsync));
|
||||
}
|
||||
{
|
||||
GetRequest getRequest = new GetRequest("index", "type", "does_not_exist");
|
||||
assertFalse(execute(getRequest, highLevelClient()::exists, highLevelClient()::existsAsync,
|
||||
highLevelClient()::exists, highLevelClient()::existsAsync));
|
||||
assertFalse(execute(getRequest, highLevelClient()::exists, highLevelClient()::existsAsync));
|
||||
}
|
||||
{
|
||||
GetRequest getRequest = new GetRequest("index", "type", "does_not_exist").version(1);
|
||||
assertFalse(execute(getRequest, highLevelClient()::exists, highLevelClient()::existsAsync,
|
||||
highLevelClient()::exists, highLevelClient()::existsAsync));
|
||||
assertFalse(execute(getRequest, highLevelClient()::exists, highLevelClient()::existsAsync));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,8 +172,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
{
|
||||
GetRequest getRequest = new GetRequest("index", "type", "id");
|
||||
ElasticsearchException exception = expectThrows(ElasticsearchException.class,
|
||||
() -> execute(getRequest, highLevelClient()::get, highLevelClient()::getAsync,
|
||||
highLevelClient()::get, highLevelClient()::getAsync));
|
||||
() -> execute(getRequest, highLevelClient()::get, highLevelClient()::getAsync));
|
||||
assertEquals(RestStatus.NOT_FOUND, exception.status());
|
||||
assertEquals("Elasticsearch exception [type=index_not_found_exception, reason=no such index]", exception.getMessage());
|
||||
assertEquals("index", exception.getMetadata("es.index").get(0));
|
||||
|
@ -196,8 +185,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
{
|
||||
GetRequest getRequest = new GetRequest("index", "type", "id").version(2);
|
||||
ElasticsearchException exception = expectThrows(ElasticsearchException.class,
|
||||
() -> execute(getRequest, highLevelClient()::get, highLevelClient()::getAsync,
|
||||
highLevelClient()::get, highLevelClient()::getAsync));
|
||||
() -> execute(getRequest, highLevelClient()::get, highLevelClient()::getAsync));
|
||||
assertEquals(RestStatus.CONFLICT, exception.status());
|
||||
assertEquals("Elasticsearch exception [type=version_conflict_engine_exception, " + "reason=[type][id]: " +
|
||||
"version conflict, current version [1] is different than the one provided [2]]", exception.getMessage());
|
||||
|
@ -208,8 +196,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
if (randomBoolean()) {
|
||||
getRequest.version(1L);
|
||||
}
|
||||
GetResponse getResponse = execute(getRequest, highLevelClient()::get, highLevelClient()::getAsync,
|
||||
highLevelClient()::get, highLevelClient()::getAsync);
|
||||
GetResponse getResponse = execute(getRequest, highLevelClient()::get, highLevelClient()::getAsync);
|
||||
assertEquals("index", getResponse.getIndex());
|
||||
assertEquals("type", getResponse.getType());
|
||||
assertEquals("id", getResponse.getId());
|
||||
|
@ -220,8 +207,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
}
|
||||
{
|
||||
GetRequest getRequest = new GetRequest("index", "type", "does_not_exist");
|
||||
GetResponse getResponse = execute(getRequest, highLevelClient()::get, highLevelClient()::getAsync,
|
||||
highLevelClient()::get, highLevelClient()::getAsync);
|
||||
GetResponse getResponse = execute(getRequest, highLevelClient()::get, highLevelClient()::getAsync);
|
||||
assertEquals("index", getResponse.getIndex());
|
||||
assertEquals("type", getResponse.getType());
|
||||
assertEquals("does_not_exist", getResponse.getId());
|
||||
|
@ -233,8 +219,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
{
|
||||
GetRequest getRequest = new GetRequest("index", "type", "id");
|
||||
getRequest.fetchSourceContext(new FetchSourceContext(false, Strings.EMPTY_ARRAY, Strings.EMPTY_ARRAY));
|
||||
GetResponse getResponse = execute(getRequest, highLevelClient()::get, highLevelClient()::getAsync,
|
||||
highLevelClient()::get, highLevelClient()::getAsync);
|
||||
GetResponse getResponse = execute(getRequest, highLevelClient()::get, highLevelClient()::getAsync);
|
||||
assertEquals("index", getResponse.getIndex());
|
||||
assertEquals("type", getResponse.getType());
|
||||
assertEquals("id", getResponse.getId());
|
||||
|
@ -250,8 +235,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
} else {
|
||||
getRequest.fetchSourceContext(new FetchSourceContext(true, Strings.EMPTY_ARRAY, new String[]{"field2"}));
|
||||
}
|
||||
GetResponse getResponse = execute(getRequest, highLevelClient()::get, highLevelClient()::getAsync,
|
||||
highLevelClient()::get, highLevelClient()::getAsync);
|
||||
GetResponse getResponse = execute(getRequest, highLevelClient()::get, highLevelClient()::getAsync);
|
||||
assertEquals("index", getResponse.getIndex());
|
||||
assertEquals("type", getResponse.getType());
|
||||
assertEquals("id", getResponse.getId());
|
||||
|
@ -269,8 +253,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
MultiGetRequest multiGetRequest = new MultiGetRequest();
|
||||
multiGetRequest.add("index", "type", "id1");
|
||||
multiGetRequest.add("index", "type", "id2");
|
||||
MultiGetResponse response = execute(multiGetRequest, highLevelClient()::multiGet, highLevelClient()::multiGetAsync,
|
||||
highLevelClient()::multiGet, highLevelClient()::multiGetAsync);
|
||||
MultiGetResponse response = execute(multiGetRequest, highLevelClient()::multiGet, highLevelClient()::multiGetAsync);
|
||||
assertEquals(2, response.getResponses().length);
|
||||
|
||||
assertTrue(response.getResponses()[0].isFailed());
|
||||
|
@ -302,8 +285,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
MultiGetRequest multiGetRequest = new MultiGetRequest();
|
||||
multiGetRequest.add("index", "type", "id1");
|
||||
multiGetRequest.add("index", "type", "id2");
|
||||
MultiGetResponse response = execute(multiGetRequest, highLevelClient()::multiGet, highLevelClient()::multiGetAsync,
|
||||
highLevelClient()::multiGet, highLevelClient()::multiGetAsync);
|
||||
MultiGetResponse response = execute(multiGetRequest, highLevelClient()::multiGet, highLevelClient()::multiGetAsync);
|
||||
assertEquals(2, response.getResponses().length);
|
||||
|
||||
assertFalse(response.getResponses()[0].isFailed());
|
||||
|
@ -328,8 +310,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
IndexRequest indexRequest = new IndexRequest("index", "type");
|
||||
indexRequest.source(XContentBuilder.builder(xContentType.xContent()).startObject().field("test", "test").endObject());
|
||||
|
||||
IndexResponse indexResponse = execute(indexRequest, highLevelClient()::index, highLevelClient()::indexAsync,
|
||||
highLevelClient()::index, highLevelClient()::indexAsync);
|
||||
IndexResponse indexResponse = execute(indexRequest, highLevelClient()::index, highLevelClient()::indexAsync);
|
||||
assertEquals(RestStatus.CREATED, indexResponse.status());
|
||||
assertEquals(DocWriteResponse.Result.CREATED, indexResponse.getResult());
|
||||
assertEquals("index", indexResponse.getIndex());
|
||||
|
@ -350,8 +331,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
IndexRequest indexRequest = new IndexRequest("index", "type", "id");
|
||||
indexRequest.source(XContentBuilder.builder(xContentType.xContent()).startObject().field("version", 1).endObject());
|
||||
|
||||
IndexResponse indexResponse = execute(indexRequest, highLevelClient()::index, highLevelClient()::indexAsync,
|
||||
highLevelClient()::index, highLevelClient()::indexAsync);
|
||||
IndexResponse indexResponse = execute(indexRequest, highLevelClient()::index, highLevelClient()::indexAsync);
|
||||
assertEquals(RestStatus.CREATED, indexResponse.status());
|
||||
assertEquals("index", indexResponse.getIndex());
|
||||
assertEquals("type", indexResponse.getType());
|
||||
|
@ -361,8 +341,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
indexRequest = new IndexRequest("index", "type", "id");
|
||||
indexRequest.source(XContentBuilder.builder(xContentType.xContent()).startObject().field("version", 2).endObject());
|
||||
|
||||
indexResponse = execute(indexRequest, highLevelClient()::index, highLevelClient()::indexAsync,
|
||||
highLevelClient()::index, highLevelClient()::indexAsync);
|
||||
indexResponse = execute(indexRequest, highLevelClient()::index, highLevelClient()::indexAsync);
|
||||
assertEquals(RestStatus.OK, indexResponse.status());
|
||||
assertEquals("index", indexResponse.getIndex());
|
||||
assertEquals("type", indexResponse.getType());
|
||||
|
@ -374,8 +353,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
wrongRequest.source(XContentBuilder.builder(xContentType.xContent()).startObject().field("field", "test").endObject());
|
||||
wrongRequest.version(5L);
|
||||
|
||||
execute(wrongRequest, highLevelClient()::index, highLevelClient()::indexAsync,
|
||||
highLevelClient()::index, highLevelClient()::indexAsync);
|
||||
execute(wrongRequest, highLevelClient()::index, highLevelClient()::indexAsync);
|
||||
});
|
||||
assertEquals(RestStatus.CONFLICT, exception.status());
|
||||
assertEquals("Elasticsearch exception [type=version_conflict_engine_exception, reason=[type][id]: " +
|
||||
|
@ -388,8 +366,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
indexRequest.source(XContentBuilder.builder(xContentType.xContent()).startObject().field("field", "test").endObject());
|
||||
indexRequest.setPipeline("missing");
|
||||
|
||||
execute(indexRequest, highLevelClient()::index, highLevelClient()::indexAsync,
|
||||
highLevelClient()::index, highLevelClient()::indexAsync);
|
||||
execute(indexRequest, highLevelClient()::index, highLevelClient()::indexAsync);
|
||||
});
|
||||
|
||||
assertEquals(RestStatus.BAD_REQUEST, exception.status());
|
||||
|
@ -402,8 +379,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
indexRequest.version(12L);
|
||||
indexRequest.versionType(VersionType.EXTERNAL);
|
||||
|
||||
IndexResponse indexResponse = execute(indexRequest, highLevelClient()::index, highLevelClient()::indexAsync,
|
||||
highLevelClient()::index, highLevelClient()::indexAsync);
|
||||
IndexResponse indexResponse = execute(indexRequest, highLevelClient()::index, highLevelClient()::indexAsync);
|
||||
assertEquals(RestStatus.CREATED, indexResponse.status());
|
||||
assertEquals("index", indexResponse.getIndex());
|
||||
assertEquals("type", indexResponse.getType());
|
||||
|
@ -415,16 +391,14 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
indexRequest.source(XContentBuilder.builder(xContentType.xContent()).startObject().field("field", "test").endObject());
|
||||
indexRequest.opType(DocWriteRequest.OpType.CREATE);
|
||||
|
||||
IndexResponse indexResponse = execute(indexRequest, highLevelClient()::index, highLevelClient()::indexAsync,
|
||||
highLevelClient()::index, highLevelClient()::indexAsync);
|
||||
IndexResponse indexResponse = execute(indexRequest, highLevelClient()::index, highLevelClient()::indexAsync);
|
||||
assertEquals(RestStatus.CREATED, indexResponse.status());
|
||||
assertEquals("index", indexResponse.getIndex());
|
||||
assertEquals("type", indexResponse.getType());
|
||||
assertEquals("with_create_op_type", indexResponse.getId());
|
||||
|
||||
ElasticsearchStatusException exception = expectThrows(ElasticsearchStatusException.class, () -> {
|
||||
execute(indexRequest, highLevelClient()::index, highLevelClient()::indexAsync,
|
||||
highLevelClient()::index, highLevelClient()::indexAsync);
|
||||
execute(indexRequest, highLevelClient()::index, highLevelClient()::indexAsync);
|
||||
});
|
||||
|
||||
assertEquals(RestStatus.CONFLICT, exception.status());
|
||||
|
@ -439,8 +413,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
updateRequest.doc(singletonMap("field", "value"), randomFrom(XContentType.values()));
|
||||
|
||||
ElasticsearchStatusException exception = expectThrows(ElasticsearchStatusException.class, () ->
|
||||
execute(updateRequest, highLevelClient()::update, highLevelClient()::updateAsync,
|
||||
highLevelClient()::update, highLevelClient()::updateAsync));
|
||||
execute(updateRequest, highLevelClient()::update, highLevelClient()::updateAsync));
|
||||
assertEquals(RestStatus.NOT_FOUND, exception.status());
|
||||
assertEquals("Elasticsearch exception [type=document_missing_exception, reason=[type][does_not_exist]: document missing]",
|
||||
exception.getMessage());
|
||||
|
@ -463,8 +436,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
updateRequestConflict.version(indexResponse.getVersion());
|
||||
|
||||
ElasticsearchStatusException exception = expectThrows(ElasticsearchStatusException.class, () ->
|
||||
execute(updateRequestConflict, highLevelClient()::update, highLevelClient()::updateAsync,
|
||||
highLevelClient()::update, highLevelClient()::updateAsync));
|
||||
execute(updateRequestConflict, highLevelClient()::update, highLevelClient()::updateAsync));
|
||||
assertEquals(RestStatus.CONFLICT, exception.status());
|
||||
assertEquals("Elasticsearch exception [type=version_conflict_engine_exception, reason=[type][id]: version conflict, " +
|
||||
"current version [2] is different than the one provided [1]]", exception.getMessage());
|
||||
|
@ -480,8 +452,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
updateRequest.script(script);
|
||||
updateRequest.fetchSource(true);
|
||||
|
||||
UpdateResponse updateResponse = execute(updateRequest, highLevelClient()::update, highLevelClient()::updateAsync,
|
||||
highLevelClient()::update, highLevelClient()::updateAsync);
|
||||
UpdateResponse updateResponse = execute(updateRequest, highLevelClient()::update, highLevelClient()::updateAsync);
|
||||
assertEquals(RestStatus.OK, updateResponse.status());
|
||||
assertEquals(DocWriteResponse.Result.UPDATED, updateResponse.getResult());
|
||||
assertEquals(2L, updateResponse.getVersion());
|
||||
|
@ -501,8 +472,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
updateRequest.doc(singletonMap("field_2", "two"), randomFrom(XContentType.values()));
|
||||
updateRequest.fetchSource("field_*", "field_3");
|
||||
|
||||
UpdateResponse updateResponse = execute(updateRequest, highLevelClient()::update, highLevelClient()::updateAsync,
|
||||
highLevelClient()::update, highLevelClient()::updateAsync);
|
||||
UpdateResponse updateResponse = execute(updateRequest, highLevelClient()::update, highLevelClient()::updateAsync);
|
||||
assertEquals(RestStatus.OK, updateResponse.status());
|
||||
assertEquals(DocWriteResponse.Result.UPDATED, updateResponse.getResult());
|
||||
assertEquals(13L, updateResponse.getVersion());
|
||||
|
@ -523,8 +493,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
UpdateRequest updateRequest = new UpdateRequest("index", "type", "noop");
|
||||
updateRequest.doc(singletonMap("field", "value"), randomFrom(XContentType.values()));
|
||||
|
||||
UpdateResponse updateResponse = execute(updateRequest, highLevelClient()::update, highLevelClient()::updateAsync,
|
||||
highLevelClient()::update, highLevelClient()::updateAsync);
|
||||
UpdateResponse updateResponse = execute(updateRequest, highLevelClient()::update, highLevelClient()::updateAsync);
|
||||
assertEquals(RestStatus.OK, updateResponse.status());
|
||||
assertEquals(DocWriteResponse.Result.NOOP, updateResponse.getResult());
|
||||
assertEquals(1L, updateResponse.getVersion());
|
||||
|
@ -542,8 +511,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
updateRequest.doc(singletonMap("doc_status", "updated"));
|
||||
updateRequest.fetchSource(true);
|
||||
|
||||
UpdateResponse updateResponse = execute(updateRequest, highLevelClient()::update, highLevelClient()::updateAsync,
|
||||
highLevelClient()::update, highLevelClient()::updateAsync);
|
||||
UpdateResponse updateResponse = execute(updateRequest, highLevelClient()::update, highLevelClient()::updateAsync);
|
||||
assertEquals(RestStatus.CREATED, updateResponse.status());
|
||||
assertEquals("index", updateResponse.getIndex());
|
||||
assertEquals("type", updateResponse.getType());
|
||||
|
@ -558,8 +526,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
updateRequest.fetchSource(true);
|
||||
updateRequest.docAsUpsert(true);
|
||||
|
||||
UpdateResponse updateResponse = execute(updateRequest, highLevelClient()::update, highLevelClient()::updateAsync,
|
||||
highLevelClient()::update, highLevelClient()::updateAsync);
|
||||
UpdateResponse updateResponse = execute(updateRequest, highLevelClient()::update, highLevelClient()::updateAsync);
|
||||
assertEquals(RestStatus.CREATED, updateResponse.status());
|
||||
assertEquals("index", updateResponse.getIndex());
|
||||
assertEquals("type", updateResponse.getType());
|
||||
|
@ -575,8 +542,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
updateRequest.scriptedUpsert(true);
|
||||
updateRequest.upsert(singletonMap("level", "A"));
|
||||
|
||||
UpdateResponse updateResponse = execute(updateRequest, highLevelClient()::update, highLevelClient()::updateAsync,
|
||||
highLevelClient()::update, highLevelClient()::updateAsync);
|
||||
UpdateResponse updateResponse = execute(updateRequest, highLevelClient()::update, highLevelClient()::updateAsync);
|
||||
assertEquals(RestStatus.CREATED, updateResponse.status());
|
||||
assertEquals("index", updateResponse.getIndex());
|
||||
assertEquals("type", updateResponse.getType());
|
||||
|
@ -591,8 +557,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
UpdateRequest updateRequest = new UpdateRequest("index", "type", "id");
|
||||
updateRequest.doc(new IndexRequest().source(Collections.singletonMap("field", "doc"), XContentType.JSON));
|
||||
updateRequest.upsert(new IndexRequest().source(Collections.singletonMap("field", "upsert"), XContentType.YAML));
|
||||
execute(updateRequest, highLevelClient()::update, highLevelClient()::updateAsync,
|
||||
highLevelClient()::update, highLevelClient()::updateAsync);
|
||||
execute(updateRequest, highLevelClient()::update, highLevelClient()::updateAsync);
|
||||
});
|
||||
assertEquals("Update request cannot have different content types for doc [JSON] and upsert [YAML] documents",
|
||||
exception.getMessage());
|
||||
|
@ -651,8 +616,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
BulkResponse bulkResponse = execute(bulkRequest, highLevelClient()::bulk, highLevelClient()::bulkAsync,
|
||||
highLevelClient()::bulk, highLevelClient()::bulkAsync);
|
||||
BulkResponse bulkResponse = execute(bulkRequest, highLevelClient()::bulk, highLevelClient()::bulkAsync);
|
||||
assertEquals(RestStatus.OK, bulkResponse.status());
|
||||
assertTrue(bulkResponse.getTook().getMillis() > 0);
|
||||
assertEquals(nbItems, bulkResponse.getItems().length);
|
||||
|
@ -688,10 +652,8 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
|||
}
|
||||
};
|
||||
|
||||
// Pull the client to a variable to work around https://bugs.eclipse.org/bugs/show_bug.cgi?id=514884
|
||||
RestHighLevelClient hlClient = highLevelClient();
|
||||
|
||||
try (BulkProcessor processor = BulkProcessor.builder(hlClient::bulkAsync, listener)
|
||||
try (BulkProcessor processor = BulkProcessor.builder(
|
||||
(request, bulkListener) -> highLevelClient().bulkAsync(request, RequestOptions.DEFAULT, bulkListener), listener)
|
||||
.setConcurrentRequests(0)
|
||||
.setBulkSize(new ByteSizeValue(5, ByteSizeUnit.GB))
|
||||
.setBulkActions(nbItems + 1)
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
package org.elasticsearch.client;
|
||||
|
||||
import org.apache.http.Header;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.ingest.PutPipelineRequest;
|
||||
import org.elasticsearch.action.support.PlainActionFuture;
|
||||
|
@ -80,43 +79,6 @@ public abstract class ESRestHighLevelClientTestCase extends ESRestTestCase {
|
|||
void execute(Request request, RequestOptions options, ActionListener<Response> listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the provided request using either the sync method or its async variant, both provided as functions
|
||||
*/
|
||||
@Deprecated
|
||||
protected static <Req, Resp> Resp execute(Req request, SyncMethod<Req, Resp> syncMethod, AsyncMethod<Req, Resp> asyncMethod,
|
||||
SyncMethodWithHeaders<Req, Resp> syncMethodWithHeaders,
|
||||
AsyncMethodWithHeaders<Req, Resp> asyncMethodWithHeaders) throws IOException {
|
||||
switch(randomIntBetween(0, 3)) {
|
||||
case 0:
|
||||
return syncMethod.execute(request, RequestOptions.DEFAULT);
|
||||
case 1:
|
||||
PlainActionFuture<Resp> future = PlainActionFuture.newFuture();
|
||||
asyncMethod.execute(request, RequestOptions.DEFAULT, future);
|
||||
return future.actionGet();
|
||||
case 2:
|
||||
return syncMethodWithHeaders.execute(request);
|
||||
case 3:
|
||||
PlainActionFuture<Resp> futureWithHeaders = PlainActionFuture.newFuture();
|
||||
asyncMethodWithHeaders.execute(request, futureWithHeaders);
|
||||
return futureWithHeaders.actionGet();
|
||||
default:
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@FunctionalInterface
|
||||
protected interface SyncMethodWithHeaders<Request, Response> {
|
||||
Response execute(Request request, Header... headers) throws IOException;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@FunctionalInterface
|
||||
protected interface AsyncMethodWithHeaders<Request, Response> {
|
||||
void execute(Request request, ActionListener<Response> listener, Header... headers);
|
||||
}
|
||||
|
||||
private static class HighLevelClient extends RestHighLevelClient {
|
||||
private HighLevelClient(RestClient restClient) {
|
||||
super(restClient, (client) -> {}, Collections.emptyList());
|
||||
|
|
|
@ -117,8 +117,6 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
boolean response = execute(
|
||||
request,
|
||||
highLevelClient().indices()::exists,
|
||||
highLevelClient().indices()::existsAsync,
|
||||
highLevelClient().indices()::exists,
|
||||
highLevelClient().indices()::existsAsync
|
||||
);
|
||||
assertTrue(response);
|
||||
|
@ -134,8 +132,6 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
boolean response = execute(
|
||||
request,
|
||||
highLevelClient().indices()::exists,
|
||||
highLevelClient().indices()::existsAsync,
|
||||
highLevelClient().indices()::exists,
|
||||
highLevelClient().indices()::existsAsync
|
||||
);
|
||||
assertFalse(response);
|
||||
|
@ -154,8 +150,6 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
boolean response = execute(
|
||||
request,
|
||||
highLevelClient().indices()::exists,
|
||||
highLevelClient().indices()::existsAsync,
|
||||
highLevelClient().indices()::exists,
|
||||
highLevelClient().indices()::existsAsync
|
||||
);
|
||||
assertFalse(response);
|
||||
|
@ -173,8 +167,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
CreateIndexRequest createIndexRequest = new CreateIndexRequest(indexName);
|
||||
|
||||
CreateIndexResponse createIndexResponse =
|
||||
execute(createIndexRequest, highLevelClient().indices()::create, highLevelClient().indices()::createAsync,
|
||||
highLevelClient().indices()::create, highLevelClient().indices()::createAsync);
|
||||
execute(createIndexRequest, highLevelClient().indices()::create, highLevelClient().indices()::createAsync);
|
||||
assertTrue(createIndexResponse.isAcknowledged());
|
||||
|
||||
assertTrue(indexExists(indexName));
|
||||
|
@ -202,8 +195,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
createIndexRequest.mapping("type_name", mappingBuilder);
|
||||
|
||||
CreateIndexResponse createIndexResponse =
|
||||
execute(createIndexRequest, highLevelClient().indices()::create, highLevelClient().indices()::createAsync,
|
||||
highLevelClient().indices()::create, highLevelClient().indices()::createAsync);
|
||||
execute(createIndexRequest, highLevelClient().indices()::create, highLevelClient().indices()::createAsync);
|
||||
assertTrue(createIndexResponse.isAcknowledged());
|
||||
|
||||
Map<String, Object> getIndexResponse = getAsMap(indexName);
|
||||
|
@ -338,8 +330,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
putMappingRequest.source(mappingBuilder);
|
||||
|
||||
PutMappingResponse putMappingResponse =
|
||||
execute(putMappingRequest, highLevelClient().indices()::putMapping, highLevelClient().indices()::putMappingAsync,
|
||||
highLevelClient().indices()::putMapping, highLevelClient().indices()::putMappingAsync);
|
||||
execute(putMappingRequest, highLevelClient().indices()::putMapping, highLevelClient().indices()::putMappingAsync);
|
||||
assertTrue(putMappingResponse.isAcknowledged());
|
||||
|
||||
Map<String, Object> getIndexResponse = getAsMap(indexName);
|
||||
|
@ -390,8 +381,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
|
||||
DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest(indexName);
|
||||
DeleteIndexResponse deleteIndexResponse =
|
||||
execute(deleteIndexRequest, highLevelClient().indices()::delete, highLevelClient().indices()::deleteAsync,
|
||||
highLevelClient().indices()::delete, highLevelClient().indices()::deleteAsync);
|
||||
execute(deleteIndexRequest, highLevelClient().indices()::delete, highLevelClient().indices()::deleteAsync);
|
||||
assertTrue(deleteIndexResponse.isAcknowledged());
|
||||
|
||||
assertFalse(indexExists(indexName));
|
||||
|
@ -404,8 +394,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest(nonExistentIndex);
|
||||
|
||||
ElasticsearchException exception = expectThrows(ElasticsearchException.class,
|
||||
() -> execute(deleteIndexRequest, highLevelClient().indices()::delete, highLevelClient().indices()::deleteAsync,
|
||||
highLevelClient().indices()::delete, highLevelClient().indices()::deleteAsync));
|
||||
() -> execute(deleteIndexRequest, highLevelClient().indices()::delete, highLevelClient().indices()::deleteAsync));
|
||||
assertEquals(RestStatus.NOT_FOUND, exception.status());
|
||||
}
|
||||
}
|
||||
|
@ -424,7 +413,6 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
addAction.routing("routing").searchRouting("search_routing").filter("{\"term\":{\"year\":2016}}");
|
||||
aliasesAddRequest.addAliasAction(addAction);
|
||||
IndicesAliasesResponse aliasesAddResponse = execute(aliasesAddRequest, highLevelClient().indices()::updateAliases,
|
||||
highLevelClient().indices()::updateAliasesAsync, highLevelClient().indices()::updateAliases,
|
||||
highLevelClient().indices()::updateAliasesAsync);
|
||||
assertTrue(aliasesAddResponse.isAcknowledged());
|
||||
assertThat(aliasExists(alias), equalTo(true));
|
||||
|
@ -443,7 +431,6 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
AliasActions removeAction = new AliasActions(AliasActions.Type.REMOVE).index(index).alias(alias);
|
||||
aliasesAddRemoveRequest.addAliasAction(removeAction);
|
||||
IndicesAliasesResponse aliasesAddRemoveResponse = execute(aliasesAddRemoveRequest, highLevelClient().indices()::updateAliases,
|
||||
highLevelClient().indices()::updateAliasesAsync, highLevelClient().indices()::updateAliases,
|
||||
highLevelClient().indices()::updateAliasesAsync);
|
||||
assertTrue(aliasesAddRemoveResponse.isAcknowledged());
|
||||
assertThat(aliasExists(alias), equalTo(false));
|
||||
|
@ -455,7 +442,6 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
AliasActions removeIndexAction = new AliasActions(AliasActions.Type.REMOVE_INDEX).index(index);
|
||||
aliasesRemoveIndexRequest.addAliasAction(removeIndexAction);
|
||||
IndicesAliasesResponse aliasesRemoveIndexResponse = execute(aliasesRemoveIndexRequest, highLevelClient().indices()::updateAliases,
|
||||
highLevelClient().indices()::updateAliasesAsync, highLevelClient().indices()::updateAliases,
|
||||
highLevelClient().indices()::updateAliasesAsync);
|
||||
assertTrue(aliasesRemoveIndexResponse.isAcknowledged());
|
||||
assertThat(aliasExists(alias), equalTo(false));
|
||||
|
@ -473,9 +459,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
IndicesAliasesRequest nonExistentIndexRequest = new IndicesAliasesRequest();
|
||||
nonExistentIndexRequest.addAliasAction(new AliasActions(AliasActions.Type.ADD).index(nonExistentIndex).alias(alias));
|
||||
ElasticsearchException exception = expectThrows(ElasticsearchException.class, () -> execute(nonExistentIndexRequest,
|
||||
highLevelClient().indices()::updateAliases, highLevelClient().indices()::updateAliasesAsync,
|
||||
highLevelClient().indices()::updateAliases,
|
||||
highLevelClient().indices()::updateAliasesAsync));
|
||||
highLevelClient().indices()::updateAliases, highLevelClient().indices()::updateAliasesAsync));
|
||||
assertThat(exception.status(), equalTo(RestStatus.NOT_FOUND));
|
||||
assertThat(exception.getMessage(), equalTo("Elasticsearch exception [type=index_not_found_exception, reason=no such index]"));
|
||||
assertThat(exception.getMetadata("es.index"), hasItem(nonExistentIndex));
|
||||
|
@ -485,8 +469,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
mixedRequest.addAliasAction(new AliasActions(AliasActions.Type.ADD).indices(index).aliases(alias));
|
||||
mixedRequest.addAliasAction(new AliasActions(AliasActions.Type.REMOVE).indices(nonExistentIndex).alias(alias));
|
||||
exception = expectThrows(ElasticsearchStatusException.class,
|
||||
() -> execute(mixedRequest, highLevelClient().indices()::updateAliases, highLevelClient().indices()::updateAliasesAsync,
|
||||
highLevelClient().indices()::updateAliases, highLevelClient().indices()::updateAliasesAsync));
|
||||
() -> execute(mixedRequest, highLevelClient().indices()::updateAliases, highLevelClient().indices()::updateAliasesAsync));
|
||||
assertThat(exception.status(), equalTo(RestStatus.NOT_FOUND));
|
||||
assertThat(exception.getMessage(), equalTo("Elasticsearch exception [type=index_not_found_exception, reason=no such index]"));
|
||||
assertThat(exception.getMetadata("es.index"), hasItem(nonExistentIndex));
|
||||
|
@ -498,7 +481,6 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
removeIndexRequest.addAliasAction(new AliasActions(AliasActions.Type.ADD).index(nonExistentIndex).alias(alias));
|
||||
removeIndexRequest.addAliasAction(new AliasActions(AliasActions.Type.REMOVE_INDEX).indices(nonExistentIndex));
|
||||
exception = expectThrows(ElasticsearchException.class, () -> execute(removeIndexRequest, highLevelClient().indices()::updateAliases,
|
||||
highLevelClient().indices()::updateAliasesAsync, highLevelClient().indices()::updateAliases,
|
||||
highLevelClient().indices()::updateAliasesAsync));
|
||||
assertThat(exception.status(), equalTo(RestStatus.NOT_FOUND));
|
||||
assertThat(exception.getMessage(), equalTo("Elasticsearch exception [type=index_not_found_exception, reason=no such index]"));
|
||||
|
@ -519,7 +501,6 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
|
||||
OpenIndexRequest openIndexRequest = new OpenIndexRequest(index);
|
||||
OpenIndexResponse openIndexResponse = execute(openIndexRequest, highLevelClient().indices()::open,
|
||||
highLevelClient().indices()::openAsync, highLevelClient().indices()::open,
|
||||
highLevelClient().indices()::openAsync);
|
||||
assertTrue(openIndexResponse.isAcknowledged());
|
||||
|
||||
|
@ -533,22 +514,19 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
|
||||
OpenIndexRequest openIndexRequest = new OpenIndexRequest(nonExistentIndex);
|
||||
ElasticsearchException exception = expectThrows(ElasticsearchException.class,
|
||||
() -> execute(openIndexRequest, highLevelClient().indices()::open, highLevelClient().indices()::openAsync,
|
||||
highLevelClient().indices()::open, highLevelClient().indices()::openAsync));
|
||||
() -> execute(openIndexRequest, highLevelClient().indices()::open, highLevelClient().indices()::openAsync));
|
||||
assertEquals(RestStatus.NOT_FOUND, exception.status());
|
||||
|
||||
OpenIndexRequest lenientOpenIndexRequest = new OpenIndexRequest(nonExistentIndex);
|
||||
lenientOpenIndexRequest.indicesOptions(IndicesOptions.lenientExpandOpen());
|
||||
OpenIndexResponse lenientOpenIndexResponse = execute(lenientOpenIndexRequest, highLevelClient().indices()::open,
|
||||
highLevelClient().indices()::openAsync, highLevelClient().indices()::open,
|
||||
highLevelClient().indices()::openAsync);
|
||||
assertThat(lenientOpenIndexResponse.isAcknowledged(), equalTo(true));
|
||||
|
||||
OpenIndexRequest strictOpenIndexRequest = new OpenIndexRequest(nonExistentIndex);
|
||||
strictOpenIndexRequest.indicesOptions(IndicesOptions.strictExpandOpen());
|
||||
ElasticsearchException strictException = expectThrows(ElasticsearchException.class,
|
||||
() -> execute(openIndexRequest, highLevelClient().indices()::open, highLevelClient().indices()::openAsync,
|
||||
highLevelClient().indices()::open, highLevelClient().indices()::openAsync));
|
||||
() -> execute(openIndexRequest, highLevelClient().indices()::open, highLevelClient().indices()::openAsync));
|
||||
assertEquals(RestStatus.NOT_FOUND, strictException.status());
|
||||
}
|
||||
|
||||
|
@ -560,7 +538,6 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
|
||||
CloseIndexRequest closeIndexRequest = new CloseIndexRequest(index);
|
||||
CloseIndexResponse closeIndexResponse = execute(closeIndexRequest, highLevelClient().indices()::close,
|
||||
highLevelClient().indices()::closeAsync, highLevelClient().indices()::close,
|
||||
highLevelClient().indices()::closeAsync);
|
||||
assertTrue(closeIndexResponse.isAcknowledged());
|
||||
|
||||
|
@ -576,8 +553,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
|
||||
CloseIndexRequest closeIndexRequest = new CloseIndexRequest(nonExistentIndex);
|
||||
ElasticsearchException exception = expectThrows(ElasticsearchException.class,
|
||||
() -> execute(closeIndexRequest, highLevelClient().indices()::close, highLevelClient().indices()::closeAsync,
|
||||
highLevelClient().indices()::close, highLevelClient().indices()::closeAsync));
|
||||
() -> execute(closeIndexRequest, highLevelClient().indices()::close, highLevelClient().indices()::closeAsync));
|
||||
assertEquals(RestStatus.NOT_FOUND, exception.status());
|
||||
}
|
||||
|
||||
|
@ -591,8 +567,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
createIndex(index, settings);
|
||||
RefreshRequest refreshRequest = new RefreshRequest(index);
|
||||
RefreshResponse refreshResponse =
|
||||
execute(refreshRequest, highLevelClient().indices()::refresh, highLevelClient().indices()::refreshAsync,
|
||||
highLevelClient().indices()::refresh, highLevelClient().indices()::refreshAsync);
|
||||
execute(refreshRequest, highLevelClient().indices()::refresh, highLevelClient().indices()::refreshAsync);
|
||||
assertThat(refreshResponse.getTotalShards(), equalTo(1));
|
||||
assertThat(refreshResponse.getSuccessfulShards(), equalTo(1));
|
||||
assertThat(refreshResponse.getFailedShards(), equalTo(0));
|
||||
|
@ -603,8 +578,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
assertFalse(indexExists(nonExistentIndex));
|
||||
RefreshRequest refreshRequest = new RefreshRequest(nonExistentIndex);
|
||||
ElasticsearchException exception = expectThrows(ElasticsearchException.class,
|
||||
() -> execute(refreshRequest, highLevelClient().indices()::refresh, highLevelClient().indices()::refreshAsync,
|
||||
highLevelClient().indices()::refresh, highLevelClient().indices()::refreshAsync));
|
||||
() -> execute(refreshRequest, highLevelClient().indices()::refresh, highLevelClient().indices()::refreshAsync));
|
||||
assertEquals(RestStatus.NOT_FOUND, exception.status());
|
||||
}
|
||||
}
|
||||
|
@ -619,8 +593,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
createIndex(index, settings);
|
||||
FlushRequest flushRequest = new FlushRequest(index);
|
||||
FlushResponse flushResponse =
|
||||
execute(flushRequest, highLevelClient().indices()::flush, highLevelClient().indices()::flushAsync,
|
||||
highLevelClient().indices()::flush, highLevelClient().indices()::flushAsync);
|
||||
execute(flushRequest, highLevelClient().indices()::flush, highLevelClient().indices()::flushAsync);
|
||||
assertThat(flushResponse.getTotalShards(), equalTo(1));
|
||||
assertThat(flushResponse.getSuccessfulShards(), equalTo(1));
|
||||
assertThat(flushResponse.getFailedShards(), equalTo(0));
|
||||
|
@ -631,8 +604,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
assertFalse(indexExists(nonExistentIndex));
|
||||
FlushRequest flushRequest = new FlushRequest(nonExistentIndex);
|
||||
ElasticsearchException exception = expectThrows(ElasticsearchException.class,
|
||||
() -> execute(flushRequest, highLevelClient().indices()::flush, highLevelClient().indices()::flushAsync,
|
||||
highLevelClient().indices()::flush, highLevelClient().indices()::flushAsync));
|
||||
() -> execute(flushRequest, highLevelClient().indices()::flush, highLevelClient().indices()::flushAsync));
|
||||
assertEquals(RestStatus.NOT_FOUND, exception.status());
|
||||
}
|
||||
}
|
||||
|
@ -680,8 +652,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
createIndex(index, settings);
|
||||
ClearIndicesCacheRequest clearCacheRequest = new ClearIndicesCacheRequest(index);
|
||||
ClearIndicesCacheResponse clearCacheResponse =
|
||||
execute(clearCacheRequest, highLevelClient().indices()::clearCache, highLevelClient().indices()::clearCacheAsync,
|
||||
highLevelClient().indices()::clearCache, highLevelClient().indices()::clearCacheAsync);
|
||||
execute(clearCacheRequest, highLevelClient().indices()::clearCache, highLevelClient().indices()::clearCacheAsync);
|
||||
assertThat(clearCacheResponse.getTotalShards(), equalTo(1));
|
||||
assertThat(clearCacheResponse.getSuccessfulShards(), equalTo(1));
|
||||
assertThat(clearCacheResponse.getFailedShards(), equalTo(0));
|
||||
|
@ -692,8 +663,8 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
assertFalse(indexExists(nonExistentIndex));
|
||||
ClearIndicesCacheRequest clearCacheRequest = new ClearIndicesCacheRequest(nonExistentIndex);
|
||||
ElasticsearchException exception = expectThrows(ElasticsearchException.class,
|
||||
() -> execute(clearCacheRequest, highLevelClient().indices()::clearCache, highLevelClient().indices()::clearCacheAsync,
|
||||
highLevelClient().indices()::clearCache, highLevelClient().indices()::clearCacheAsync));
|
||||
() -> execute(clearCacheRequest, highLevelClient().indices()::clearCache,
|
||||
highLevelClient().indices()::clearCacheAsync));
|
||||
assertEquals(RestStatus.NOT_FOUND, exception.status());
|
||||
}
|
||||
}
|
||||
|
@ -708,8 +679,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
createIndex(index, settings);
|
||||
ForceMergeRequest forceMergeRequest = new ForceMergeRequest(index);
|
||||
ForceMergeResponse forceMergeResponse =
|
||||
execute(forceMergeRequest, highLevelClient().indices()::forceMerge, highLevelClient().indices()::forceMergeAsync,
|
||||
highLevelClient().indices()::forceMerge, highLevelClient().indices()::forceMergeAsync);
|
||||
execute(forceMergeRequest, highLevelClient().indices()::forceMerge, highLevelClient().indices()::forceMergeAsync);
|
||||
assertThat(forceMergeResponse.getTotalShards(), equalTo(1));
|
||||
assertThat(forceMergeResponse.getSuccessfulShards(), equalTo(1));
|
||||
assertThat(forceMergeResponse.getFailedShards(), equalTo(0));
|
||||
|
@ -720,30 +690,25 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
assertFalse(indexExists(nonExistentIndex));
|
||||
ForceMergeRequest forceMergeRequest = new ForceMergeRequest(nonExistentIndex);
|
||||
ElasticsearchException exception = expectThrows(ElasticsearchException.class,
|
||||
() -> execute(forceMergeRequest, highLevelClient().indices()::forceMerge, highLevelClient().indices()::forceMergeAsync,
|
||||
highLevelClient().indices()::forceMerge, highLevelClient().indices()::forceMergeAsync));
|
||||
() -> execute(forceMergeRequest, highLevelClient().indices()::forceMerge, highLevelClient().indices()::forceMergeAsync));
|
||||
assertEquals(RestStatus.NOT_FOUND, exception.status());
|
||||
}
|
||||
}
|
||||
|
||||
public void testExistsAlias() throws IOException {
|
||||
GetAliasesRequest getAliasesRequest = new GetAliasesRequest("alias");
|
||||
assertFalse(execute(getAliasesRequest, highLevelClient().indices()::existsAlias, highLevelClient().indices()::existsAliasAsync,
|
||||
highLevelClient().indices()::existsAlias, highLevelClient().indices()::existsAliasAsync));
|
||||
assertFalse(execute(getAliasesRequest, highLevelClient().indices()::existsAlias, highLevelClient().indices()::existsAliasAsync));
|
||||
|
||||
createIndex("index", Settings.EMPTY);
|
||||
client().performRequest(HttpPut.METHOD_NAME, "/index/_alias/alias");
|
||||
assertTrue(execute(getAliasesRequest, highLevelClient().indices()::existsAlias, highLevelClient().indices()::existsAliasAsync,
|
||||
highLevelClient().indices()::existsAlias, highLevelClient().indices()::existsAliasAsync));
|
||||
assertTrue(execute(getAliasesRequest, highLevelClient().indices()::existsAlias, highLevelClient().indices()::existsAliasAsync));
|
||||
|
||||
GetAliasesRequest getAliasesRequest2 = new GetAliasesRequest();
|
||||
getAliasesRequest2.aliases("alias");
|
||||
getAliasesRequest2.indices("index");
|
||||
assertTrue(execute(getAliasesRequest2, highLevelClient().indices()::existsAlias, highLevelClient().indices()::existsAliasAsync,
|
||||
highLevelClient().indices()::existsAlias, highLevelClient().indices()::existsAliasAsync));
|
||||
assertTrue(execute(getAliasesRequest2, highLevelClient().indices()::existsAlias, highLevelClient().indices()::existsAliasAsync));
|
||||
getAliasesRequest2.indices("does_not_exist");
|
||||
assertFalse(execute(getAliasesRequest2, highLevelClient().indices()::existsAlias, highLevelClient().indices()::existsAliasAsync,
|
||||
highLevelClient().indices()::existsAlias, highLevelClient().indices()::existsAliasAsync));
|
||||
assertFalse(execute(getAliasesRequest2, highLevelClient().indices()::existsAlias, highLevelClient().indices()::existsAliasAsync));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -764,7 +729,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
.build();
|
||||
resizeRequest.setTargetIndex(new CreateIndexRequest("target").settings(targetSettings).alias(new Alias("alias")));
|
||||
ResizeResponse resizeResponse = execute(resizeRequest, highLevelClient().indices()::shrink,
|
||||
highLevelClient().indices()::shrinkAsync, highLevelClient().indices()::shrink, highLevelClient().indices()::shrinkAsync);
|
||||
highLevelClient().indices()::shrinkAsync);
|
||||
assertTrue(resizeResponse.isAcknowledged());
|
||||
assertTrue(resizeResponse.isShardsAcknowledged());
|
||||
Map<String, Object> getIndexResponse = getAsMap("target");
|
||||
|
@ -786,8 +751,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
resizeRequest.setResizeType(ResizeType.SPLIT);
|
||||
Settings targetSettings = Settings.builder().put("index.number_of_shards", 4).put("index.number_of_replicas", 0).build();
|
||||
resizeRequest.setTargetIndex(new CreateIndexRequest("target").settings(targetSettings).alias(new Alias("alias")));
|
||||
ResizeResponse resizeResponse = execute(resizeRequest, highLevelClient().indices()::split, highLevelClient().indices()::splitAsync,
|
||||
highLevelClient().indices()::split, highLevelClient().indices()::splitAsync);
|
||||
ResizeResponse resizeResponse = execute(resizeRequest, highLevelClient().indices()::split, highLevelClient().indices()::splitAsync);
|
||||
assertTrue(resizeResponse.isAcknowledged());
|
||||
assertTrue(resizeResponse.isShardsAcknowledged());
|
||||
Map<String, Object> getIndexResponse = getAsMap("target");
|
||||
|
@ -806,7 +770,6 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
|
||||
{
|
||||
RolloverResponse rolloverResponse = execute(rolloverRequest, highLevelClient().indices()::rollover,
|
||||
highLevelClient().indices()::rolloverAsync, highLevelClient().indices()::rollover,
|
||||
highLevelClient().indices()::rolloverAsync);
|
||||
assertFalse(rolloverResponse.isRolledOver());
|
||||
assertFalse(rolloverResponse.isDryRun());
|
||||
|
@ -826,7 +789,6 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
rolloverRequest.addMaxIndexAgeCondition(new TimeValue(1));
|
||||
rolloverRequest.dryRun(true);
|
||||
RolloverResponse rolloverResponse = execute(rolloverRequest, highLevelClient().indices()::rollover,
|
||||
highLevelClient().indices()::rolloverAsync, highLevelClient().indices()::rollover,
|
||||
highLevelClient().indices()::rolloverAsync);
|
||||
assertFalse(rolloverResponse.isRolledOver());
|
||||
assertTrue(rolloverResponse.isDryRun());
|
||||
|
@ -841,7 +803,6 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
rolloverRequest.dryRun(false);
|
||||
rolloverRequest.addMaxIndexSizeCondition(new ByteSizeValue(1, ByteSizeUnit.MB));
|
||||
RolloverResponse rolloverResponse = execute(rolloverRequest, highLevelClient().indices()::rollover,
|
||||
highLevelClient().indices()::rolloverAsync, highLevelClient().indices()::rollover,
|
||||
highLevelClient().indices()::rolloverAsync);
|
||||
assertTrue(rolloverResponse.isRolledOver());
|
||||
assertFalse(rolloverResponse.isDryRun());
|
||||
|
@ -1067,7 +1028,6 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
UpdateSettingsRequest dynamicSettingRequest = new UpdateSettingsRequest();
|
||||
dynamicSettingRequest.settings(Settings.builder().put(dynamicSettingKey, dynamicSettingValue).build());
|
||||
UpdateSettingsResponse response = execute(dynamicSettingRequest, highLevelClient().indices()::putSettings,
|
||||
highLevelClient().indices()::putSettingsAsync, highLevelClient().indices()::putSettings,
|
||||
highLevelClient().indices()::putSettingsAsync);
|
||||
|
||||
assertTrue(response.isAcknowledged());
|
||||
|
@ -1078,7 +1038,6 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
UpdateSettingsRequest staticSettingRequest = new UpdateSettingsRequest();
|
||||
staticSettingRequest.settings(Settings.builder().put(staticSettingKey, staticSettingValue).build());
|
||||
ElasticsearchException exception = expectThrows(ElasticsearchException.class, () -> execute(staticSettingRequest,
|
||||
highLevelClient().indices()::putSettings, highLevelClient().indices()::putSettingsAsync,
|
||||
highLevelClient().indices()::putSettings, highLevelClient().indices()::putSettingsAsync));
|
||||
assertThat(exception.getMessage(),
|
||||
startsWith("Elasticsearch exception [type=illegal_argument_exception, "
|
||||
|
@ -1089,7 +1048,6 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
|
||||
closeIndex(index);
|
||||
response = execute(staticSettingRequest, highLevelClient().indices()::putSettings,
|
||||
highLevelClient().indices()::putSettingsAsync, highLevelClient().indices()::putSettings,
|
||||
highLevelClient().indices()::putSettingsAsync);
|
||||
assertTrue(response.isAcknowledged());
|
||||
openIndex(index);
|
||||
|
@ -1100,7 +1058,6 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
UpdateSettingsRequest unmodifiableSettingRequest = new UpdateSettingsRequest();
|
||||
unmodifiableSettingRequest.settings(Settings.builder().put(unmodifiableSettingKey, unmodifiableSettingValue).build());
|
||||
exception = expectThrows(ElasticsearchException.class, () -> execute(unmodifiableSettingRequest,
|
||||
highLevelClient().indices()::putSettings, highLevelClient().indices()::putSettingsAsync,
|
||||
highLevelClient().indices()::putSettings, highLevelClient().indices()::putSettingsAsync));
|
||||
assertThat(exception.getMessage(), startsWith(
|
||||
"Elasticsearch exception [type=illegal_argument_exception, "
|
||||
|
@ -1128,14 +1085,12 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
indexUpdateSettingsRequest.settings(Settings.builder().put(setting, value).build());
|
||||
|
||||
ElasticsearchException exception = expectThrows(ElasticsearchException.class, () -> execute(indexUpdateSettingsRequest,
|
||||
highLevelClient().indices()::putSettings, highLevelClient().indices()::putSettingsAsync,
|
||||
highLevelClient().indices()::putSettings, highLevelClient().indices()::putSettingsAsync));
|
||||
assertEquals(RestStatus.NOT_FOUND, exception.status());
|
||||
assertThat(exception.getMessage(), equalTo("Elasticsearch exception [type=index_not_found_exception, reason=no such index]"));
|
||||
|
||||
createIndex(index, Settings.EMPTY);
|
||||
exception = expectThrows(ElasticsearchException.class, () -> execute(indexUpdateSettingsRequest,
|
||||
highLevelClient().indices()::putSettings, highLevelClient().indices()::putSettingsAsync,
|
||||
highLevelClient().indices()::putSettings, highLevelClient().indices()::putSettingsAsync));
|
||||
assertThat(exception.status(), equalTo(RestStatus.BAD_REQUEST));
|
||||
assertThat(exception.getMessage(), equalTo(
|
||||
|
|
|
@ -82,8 +82,7 @@ public class RankEvalIT extends ESRestHighLevelClientTestCase {
|
|||
RankEvalSpec spec = new RankEvalSpec(specifications, metric);
|
||||
|
||||
RankEvalRequest rankEvalRequest = new RankEvalRequest(spec, new String[] { "index", "index2" });
|
||||
RankEvalResponse response = execute(rankEvalRequest, highLevelClient()::rankEval, highLevelClient()::rankEvalAsync,
|
||||
highLevelClient()::rankEval, highLevelClient()::rankEvalAsync);
|
||||
RankEvalResponse response = execute(rankEvalRequest, highLevelClient()::rankEval, highLevelClient()::rankEvalAsync);
|
||||
// the expected Prec@ for the first query is 5/7 and the expected Prec@ for the second is 1/7, divided by 2 to get the average
|
||||
double expectedPrecision = (1.0 / 7.0 + 5.0 / 7.0) / 2.0;
|
||||
assertEquals(expectedPrecision, response.getEvaluationResult(), Double.MIN_VALUE);
|
||||
|
@ -117,8 +116,7 @@ public class RankEvalIT extends ESRestHighLevelClientTestCase {
|
|||
// now try this when test2 is closed
|
||||
client().performRequest("POST", "index2/_close", Collections.emptyMap());
|
||||
rankEvalRequest.indicesOptions(IndicesOptions.fromParameters(null, "true", null, SearchRequest.DEFAULT_INDICES_OPTIONS));
|
||||
response = execute(rankEvalRequest, highLevelClient()::rankEval, highLevelClient()::rankEvalAsync,
|
||||
highLevelClient()::rankEval, highLevelClient()::rankEvalAsync);
|
||||
response = execute(rankEvalRequest, highLevelClient()::rankEval, highLevelClient()::rankEvalAsync);
|
||||
}
|
||||
|
||||
private static List<RatedDocument> createRelevant(String indexName, String... docs) {
|
||||
|
|
|
@ -188,12 +188,12 @@ public class RestHighLevelClientTests extends ESTestCase {
|
|||
|
||||
{
|
||||
ActionRequestValidationException actualException = expectThrows(ActionRequestValidationException.class,
|
||||
() -> restHighLevelClient.performRequest(request, null, null, null));
|
||||
() -> restHighLevelClient.performRequest(request, null, RequestOptions.DEFAULT, null, null));
|
||||
assertSame(validationException, actualException);
|
||||
}
|
||||
{
|
||||
TrackingActionListener trackingActionListener = new TrackingActionListener();
|
||||
restHighLevelClient.performRequestAsync(request, null, null, trackingActionListener, null);
|
||||
restHighLevelClient.performRequestAsync(request, null, RequestOptions.DEFAULT, null, trackingActionListener, null);
|
||||
assertSame(validationException, trackingActionListener.exception.get());
|
||||
}
|
||||
}
|
||||
|
@ -307,13 +307,13 @@ public class RestHighLevelClientTests extends ESTestCase {
|
|||
Response mockResponse = new Response(REQUEST_LINE, new HttpHost("localhost", 9200), httpResponse);
|
||||
when(restClient.performRequest(any(Request.class))).thenReturn(mockResponse);
|
||||
{
|
||||
Integer result = restHighLevelClient.performRequest(mainRequest, requestConverter,
|
||||
Integer result = restHighLevelClient.performRequest(mainRequest, requestConverter, RequestOptions.DEFAULT,
|
||||
response -> response.getStatusLine().getStatusCode(), Collections.emptySet());
|
||||
assertEquals(restStatus.getStatus(), result.intValue());
|
||||
}
|
||||
{
|
||||
IOException ioe = expectThrows(IOException.class, () -> restHighLevelClient.performRequest(mainRequest,
|
||||
requestConverter, response -> {throw new IllegalStateException();}, Collections.emptySet()));
|
||||
requestConverter, RequestOptions.DEFAULT, response -> {throw new IllegalStateException();}, Collections.emptySet()));
|
||||
assertEquals("Unable to parse response body for Response{requestLine=GET / http/1.1, host=http://localhost:9200, " +
|
||||
"response=http/1.1 " + restStatus.getStatus() + " " + restStatus.name() + "}", ioe.getMessage());
|
||||
}
|
||||
|
@ -328,7 +328,7 @@ public class RestHighLevelClientTests extends ESTestCase {
|
|||
ResponseException responseException = new ResponseException(mockResponse);
|
||||
when(restClient.performRequest(any(Request.class))).thenThrow(responseException);
|
||||
ElasticsearchException elasticsearchException = expectThrows(ElasticsearchException.class,
|
||||
() -> restHighLevelClient.performRequest(mainRequest, requestConverter,
|
||||
() -> restHighLevelClient.performRequest(mainRequest, requestConverter, RequestOptions.DEFAULT,
|
||||
response -> response.getStatusLine().getStatusCode(), Collections.emptySet()));
|
||||
assertEquals(responseException.getMessage(), elasticsearchException.getMessage());
|
||||
assertEquals(restStatus, elasticsearchException.status());
|
||||
|
@ -346,7 +346,7 @@ public class RestHighLevelClientTests extends ESTestCase {
|
|||
ResponseException responseException = new ResponseException(mockResponse);
|
||||
when(restClient.performRequest(any(Request.class))).thenThrow(responseException);
|
||||
ElasticsearchException elasticsearchException = expectThrows(ElasticsearchException.class,
|
||||
() -> restHighLevelClient.performRequest(mainRequest, requestConverter,
|
||||
() -> restHighLevelClient.performRequest(mainRequest, requestConverter, RequestOptions.DEFAULT,
|
||||
response -> response.getStatusLine().getStatusCode(), Collections.emptySet()));
|
||||
assertEquals("Elasticsearch exception [type=exception, reason=test error message]", elasticsearchException.getMessage());
|
||||
assertEquals(restStatus, elasticsearchException.status());
|
||||
|
@ -363,7 +363,7 @@ public class RestHighLevelClientTests extends ESTestCase {
|
|||
ResponseException responseException = new ResponseException(mockResponse);
|
||||
when(restClient.performRequest(any(Request.class))).thenThrow(responseException);
|
||||
ElasticsearchException elasticsearchException = expectThrows(ElasticsearchException.class,
|
||||
() -> restHighLevelClient.performRequest(mainRequest, requestConverter,
|
||||
() -> restHighLevelClient.performRequest(mainRequest, requestConverter, RequestOptions.DEFAULT,
|
||||
response -> response.getStatusLine().getStatusCode(), Collections.emptySet()));
|
||||
assertEquals("Unable to parse response body", elasticsearchException.getMessage());
|
||||
assertEquals(restStatus, elasticsearchException.status());
|
||||
|
@ -381,7 +381,7 @@ public class RestHighLevelClientTests extends ESTestCase {
|
|||
ResponseException responseException = new ResponseException(mockResponse);
|
||||
when(restClient.performRequest(any(Request.class))).thenThrow(responseException);
|
||||
ElasticsearchException elasticsearchException = expectThrows(ElasticsearchException.class,
|
||||
() -> restHighLevelClient.performRequest(mainRequest, requestConverter,
|
||||
() -> restHighLevelClient.performRequest(mainRequest, requestConverter, RequestOptions.DEFAULT,
|
||||
response -> response.getStatusLine().getStatusCode(), Collections.emptySet()));
|
||||
assertEquals("Unable to parse response body", elasticsearchException.getMessage());
|
||||
assertEquals(restStatus, elasticsearchException.status());
|
||||
|
@ -397,7 +397,7 @@ public class RestHighLevelClientTests extends ESTestCase {
|
|||
ResponseException responseException = new ResponseException(mockResponse);
|
||||
when(restClient.performRequest(any(Request.class))).thenThrow(responseException);
|
||||
//although we got an exception, we turn it into a successful response because the status code was provided among ignores
|
||||
assertEquals(Integer.valueOf(404), restHighLevelClient.performRequest(mainRequest, requestConverter,
|
||||
assertEquals(Integer.valueOf(404), restHighLevelClient.performRequest(mainRequest, requestConverter, RequestOptions.DEFAULT,
|
||||
response -> response.getStatusLine().getStatusCode(), Collections.singleton(404)));
|
||||
}
|
||||
|
||||
|
@ -409,7 +409,7 @@ public class RestHighLevelClientTests extends ESTestCase {
|
|||
ResponseException responseException = new ResponseException(mockResponse);
|
||||
when(restClient.performRequest(any(Request.class))).thenThrow(responseException);
|
||||
ElasticsearchException elasticsearchException = expectThrows(ElasticsearchException.class,
|
||||
() -> restHighLevelClient.performRequest(mainRequest, requestConverter,
|
||||
() -> restHighLevelClient.performRequest(mainRequest, requestConverter, RequestOptions.DEFAULT,
|
||||
response -> {throw new IllegalStateException();}, Collections.singleton(404)));
|
||||
assertEquals(RestStatus.NOT_FOUND, elasticsearchException.status());
|
||||
assertSame(responseException, elasticsearchException.getCause());
|
||||
|
@ -426,7 +426,7 @@ public class RestHighLevelClientTests extends ESTestCase {
|
|||
ResponseException responseException = new ResponseException(mockResponse);
|
||||
when(restClient.performRequest(any(Request.class))).thenThrow(responseException);
|
||||
ElasticsearchException elasticsearchException = expectThrows(ElasticsearchException.class,
|
||||
() -> restHighLevelClient.performRequest(mainRequest, requestConverter,
|
||||
() -> restHighLevelClient.performRequest(mainRequest, requestConverter, RequestOptions.DEFAULT,
|
||||
response -> {throw new IllegalStateException();}, Collections.singleton(404)));
|
||||
assertEquals(RestStatus.NOT_FOUND, elasticsearchException.status());
|
||||
assertSame(responseException, elasticsearchException.getSuppressed()[0]);
|
||||
|
|
|
@ -164,8 +164,7 @@ public class SearchIT extends ESRestHighLevelClientTestCase {
|
|||
public void testSearchMatchQuery() throws IOException {
|
||||
SearchRequest searchRequest = new SearchRequest("index");
|
||||
searchRequest.source(new SearchSourceBuilder().query(new MatchQueryBuilder("num", 10)));
|
||||
SearchResponse searchResponse = execute(searchRequest, highLevelClient()::search, highLevelClient()::searchAsync,
|
||||
highLevelClient()::search, highLevelClient()::searchAsync);
|
||||
SearchResponse searchResponse = execute(searchRequest, highLevelClient()::search, highLevelClient()::searchAsync);
|
||||
assertSearchHeader(searchResponse);
|
||||
assertNull(searchResponse.getAggregations());
|
||||
assertNull(searchResponse.getSuggest());
|
||||
|
@ -191,8 +190,7 @@ public class SearchIT extends ESRestHighLevelClientTestCase {
|
|||
searchSourceBuilder.aggregation(new TermsAggregationBuilder("agg1", ValueType.STRING).field("type.keyword"));
|
||||
searchSourceBuilder.size(0);
|
||||
searchRequest.source(searchSourceBuilder);
|
||||
SearchResponse searchResponse = execute(searchRequest, highLevelClient()::search, highLevelClient()::searchAsync,
|
||||
highLevelClient()::search, highLevelClient()::searchAsync);
|
||||
SearchResponse searchResponse = execute(searchRequest, highLevelClient()::search, highLevelClient()::searchAsync);
|
||||
assertSearchHeader(searchResponse);
|
||||
assertNull(searchResponse.getSuggest());
|
||||
assertEquals(Collections.emptyMap(), searchResponse.getProfileResults());
|
||||
|
@ -218,8 +216,7 @@ public class SearchIT extends ESRestHighLevelClientTestCase {
|
|||
searchRequest.source(searchSourceBuilder);
|
||||
|
||||
ElasticsearchStatusException exception = expectThrows(ElasticsearchStatusException.class,
|
||||
() -> execute(searchRequest, highLevelClient()::search, highLevelClient()::searchAsync,
|
||||
highLevelClient()::search, highLevelClient()::searchAsync));
|
||||
() -> execute(searchRequest, highLevelClient()::search, highLevelClient()::searchAsync));
|
||||
assertEquals(RestStatus.BAD_REQUEST, exception.status());
|
||||
}
|
||||
|
||||
|
@ -229,8 +226,7 @@ public class SearchIT extends ESRestHighLevelClientTestCase {
|
|||
.addRange("first", 0, 30).addRange("second", 31, 200));
|
||||
searchSourceBuilder.size(0);
|
||||
searchRequest.source(searchSourceBuilder);
|
||||
SearchResponse searchResponse = execute(searchRequest, highLevelClient()::search, highLevelClient()::searchAsync,
|
||||
highLevelClient()::search, highLevelClient()::searchAsync);
|
||||
SearchResponse searchResponse = execute(searchRequest, highLevelClient()::search, highLevelClient()::searchAsync);
|
||||
assertSearchHeader(searchResponse);
|
||||
assertNull(searchResponse.getSuggest());
|
||||
assertEquals(Collections.emptyMap(), searchResponse.getProfileResults());
|
||||
|
@ -261,8 +257,7 @@ public class SearchIT extends ESRestHighLevelClientTestCase {
|
|||
searchSourceBuilder.aggregation(agg);
|
||||
searchSourceBuilder.size(0);
|
||||
searchRequest.source(searchSourceBuilder);
|
||||
SearchResponse searchResponse = execute(searchRequest, highLevelClient()::search, highLevelClient()::searchAsync,
|
||||
highLevelClient()::search, highLevelClient()::searchAsync);
|
||||
SearchResponse searchResponse = execute(searchRequest, highLevelClient()::search, highLevelClient()::searchAsync);
|
||||
assertSearchHeader(searchResponse);
|
||||
assertNull(searchResponse.getSuggest());
|
||||
assertEquals(Collections.emptyMap(), searchResponse.getProfileResults());
|
||||
|
@ -313,8 +308,7 @@ public class SearchIT extends ESRestHighLevelClientTestCase {
|
|||
searchSourceBuilder.aggregation(new MatrixStatsAggregationBuilder("agg1").fields(Arrays.asList("num", "num2")));
|
||||
searchSourceBuilder.size(0);
|
||||
searchRequest.source(searchSourceBuilder);
|
||||
SearchResponse searchResponse = execute(searchRequest, highLevelClient()::search, highLevelClient()::searchAsync,
|
||||
highLevelClient()::search, highLevelClient()::searchAsync);
|
||||
SearchResponse searchResponse = execute(searchRequest, highLevelClient()::search, highLevelClient()::searchAsync);
|
||||
assertSearchHeader(searchResponse);
|
||||
assertNull(searchResponse.getSuggest());
|
||||
assertEquals(Collections.emptyMap(), searchResponse.getProfileResults());
|
||||
|
@ -403,8 +397,7 @@ public class SearchIT extends ESRestHighLevelClientTestCase {
|
|||
SearchRequest searchRequest = new SearchRequest(indexName);
|
||||
searchRequest.source(searchSourceBuilder);
|
||||
|
||||
SearchResponse searchResponse = execute(searchRequest, highLevelClient()::search, highLevelClient()::searchAsync,
|
||||
highLevelClient()::search, highLevelClient()::searchAsync);
|
||||
SearchResponse searchResponse = execute(searchRequest, highLevelClient()::search, highLevelClient()::searchAsync);
|
||||
assertSearchHeader(searchResponse);
|
||||
assertNull(searchResponse.getSuggest());
|
||||
assertEquals(Collections.emptyMap(), searchResponse.getProfileResults());
|
||||
|
@ -444,8 +437,7 @@ public class SearchIT extends ESRestHighLevelClientTestCase {
|
|||
searchSourceBuilder.size(0);
|
||||
searchRequest.source(searchSourceBuilder);
|
||||
|
||||
SearchResponse searchResponse = execute(searchRequest, highLevelClient()::search, highLevelClient()::searchAsync,
|
||||
highLevelClient()::search, highLevelClient()::searchAsync);
|
||||
SearchResponse searchResponse = execute(searchRequest, highLevelClient()::search, highLevelClient()::searchAsync);
|
||||
assertSearchHeader(searchResponse);
|
||||
assertNull(searchResponse.getAggregations());
|
||||
assertEquals(Collections.emptyMap(), searchResponse.getProfileResults());
|
||||
|
@ -477,8 +469,7 @@ public class SearchIT extends ESRestHighLevelClientTestCase {
|
|||
{
|
||||
SearchRequest searchRequest = new SearchRequest("test").source(SearchSourceBuilder.searchSource()
|
||||
.scriptField("result", new Script("null")));
|
||||
SearchResponse searchResponse = execute(searchRequest, highLevelClient()::search, highLevelClient()::searchAsync,
|
||||
highLevelClient()::search, highLevelClient()::searchAsync);
|
||||
SearchResponse searchResponse = execute(searchRequest, highLevelClient()::search, highLevelClient()::searchAsync);
|
||||
SearchHit searchHit = searchResponse.getHits().getAt(0);
|
||||
List<Object> values = searchHit.getFields().get("result").getValues();
|
||||
assertNotNull(values);
|
||||
|
@ -488,8 +479,7 @@ public class SearchIT extends ESRestHighLevelClientTestCase {
|
|||
{
|
||||
SearchRequest searchRequest = new SearchRequest("test").source(SearchSourceBuilder.searchSource()
|
||||
.scriptField("result", new Script("new HashMap()")));
|
||||
SearchResponse searchResponse = execute(searchRequest, highLevelClient()::search, highLevelClient()::searchAsync,
|
||||
highLevelClient()::search, highLevelClient()::searchAsync);
|
||||
SearchResponse searchResponse = execute(searchRequest, highLevelClient()::search, highLevelClient()::searchAsync);
|
||||
SearchHit searchHit = searchResponse.getHits().getAt(0);
|
||||
List<Object> values = searchHit.getFields().get("result").getValues();
|
||||
assertNotNull(values);
|
||||
|
@ -501,8 +491,7 @@ public class SearchIT extends ESRestHighLevelClientTestCase {
|
|||
{
|
||||
SearchRequest searchRequest = new SearchRequest("test").source(SearchSourceBuilder.searchSource()
|
||||
.scriptField("result", new Script("new String[]{}")));
|
||||
SearchResponse searchResponse = execute(searchRequest, highLevelClient()::search, highLevelClient()::searchAsync,
|
||||
highLevelClient()::search, highLevelClient()::searchAsync);
|
||||
SearchResponse searchResponse = execute(searchRequest, highLevelClient()::search, highLevelClient()::searchAsync);
|
||||
SearchHit searchHit = searchResponse.getHits().getAt(0);
|
||||
List<Object> values = searchHit.getFields().get("result").getValues();
|
||||
assertNotNull(values);
|
||||
|
@ -524,8 +513,7 @@ public class SearchIT extends ESRestHighLevelClientTestCase {
|
|||
|
||||
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder().size(35).sort("field", SortOrder.ASC);
|
||||
SearchRequest searchRequest = new SearchRequest("test").scroll(TimeValue.timeValueMinutes(2)).source(searchSourceBuilder);
|
||||
SearchResponse searchResponse = execute(searchRequest, highLevelClient()::search, highLevelClient()::searchAsync,
|
||||
highLevelClient()::search, highLevelClient()::searchAsync);
|
||||
SearchResponse searchResponse = execute(searchRequest, highLevelClient()::search, highLevelClient()::searchAsync);
|
||||
|
||||
try {
|
||||
long counter = 0;
|
||||
|
@ -537,7 +525,6 @@ public class SearchIT extends ESRestHighLevelClientTestCase {
|
|||
}
|
||||
|
||||
searchResponse = execute(new SearchScrollRequest(searchResponse.getScrollId()).scroll(TimeValue.timeValueMinutes(2)),
|
||||
highLevelClient()::searchScroll, highLevelClient()::searchScrollAsync,
|
||||
highLevelClient()::searchScroll, highLevelClient()::searchScrollAsync);
|
||||
|
||||
assertThat(searchResponse.getHits().getTotalHits(), equalTo(100L));
|
||||
|
@ -547,7 +534,6 @@ public class SearchIT extends ESRestHighLevelClientTestCase {
|
|||
}
|
||||
|
||||
searchResponse = execute(new SearchScrollRequest(searchResponse.getScrollId()).scroll(TimeValue.timeValueMinutes(2)),
|
||||
highLevelClient()::searchScroll, highLevelClient()::searchScrollAsync,
|
||||
highLevelClient()::searchScroll, highLevelClient()::searchScrollAsync);
|
||||
|
||||
assertThat(searchResponse.getHits().getTotalHits(), equalTo(100L));
|
||||
|
@ -559,14 +545,12 @@ public class SearchIT extends ESRestHighLevelClientTestCase {
|
|||
ClearScrollRequest clearScrollRequest = new ClearScrollRequest();
|
||||
clearScrollRequest.addScrollId(searchResponse.getScrollId());
|
||||
ClearScrollResponse clearScrollResponse = execute(clearScrollRequest,
|
||||
highLevelClient()::clearScroll, highLevelClient()::clearScrollAsync,
|
||||
highLevelClient()::clearScroll, highLevelClient()::clearScrollAsync);
|
||||
assertThat(clearScrollResponse.getNumFreed(), greaterThan(0));
|
||||
assertTrue(clearScrollResponse.isSucceeded());
|
||||
|
||||
SearchScrollRequest scrollRequest = new SearchScrollRequest(searchResponse.getScrollId()).scroll(TimeValue.timeValueMinutes(2));
|
||||
ElasticsearchStatusException exception = expectThrows(ElasticsearchStatusException.class, () -> execute(scrollRequest,
|
||||
highLevelClient()::searchScroll, highLevelClient()::searchScrollAsync,
|
||||
highLevelClient()::searchScroll, highLevelClient()::searchScrollAsync));
|
||||
assertEquals(RestStatus.NOT_FOUND, exception.status());
|
||||
assertThat(exception.getRootCause(), instanceOf(ElasticsearchException.class));
|
||||
|
@ -588,8 +572,7 @@ public class SearchIT extends ESRestHighLevelClientTestCase {
|
|||
multiSearchRequest.add(searchRequest3);
|
||||
|
||||
MultiSearchResponse multiSearchResponse =
|
||||
execute(multiSearchRequest, highLevelClient()::multiSearch, highLevelClient()::multiSearchAsync,
|
||||
highLevelClient()::multiSearch, highLevelClient()::multiSearchAsync);
|
||||
execute(multiSearchRequest, highLevelClient()::multiSearch, highLevelClient()::multiSearchAsync);
|
||||
assertThat(multiSearchResponse.getTook().millis(), Matchers.greaterThanOrEqualTo(0L));
|
||||
assertThat(multiSearchResponse.getResponses().length, Matchers.equalTo(3));
|
||||
|
||||
|
@ -631,8 +614,7 @@ public class SearchIT extends ESRestHighLevelClientTestCase {
|
|||
multiSearchRequest.add(searchRequest3);
|
||||
|
||||
MultiSearchResponse multiSearchResponse =
|
||||
execute(multiSearchRequest, highLevelClient()::multiSearch, highLevelClient()::multiSearchAsync,
|
||||
highLevelClient()::multiSearch, highLevelClient()::multiSearchAsync);
|
||||
execute(multiSearchRequest, highLevelClient()::multiSearch, highLevelClient()::multiSearchAsync);
|
||||
assertThat(multiSearchResponse.getTook().millis(), Matchers.greaterThanOrEqualTo(0L));
|
||||
assertThat(multiSearchResponse.getResponses().length, Matchers.equalTo(3));
|
||||
|
||||
|
@ -680,8 +662,7 @@ public class SearchIT extends ESRestHighLevelClientTestCase {
|
|||
multiSearchRequest.add(searchRequest3);
|
||||
|
||||
MultiSearchResponse multiSearchResponse =
|
||||
execute(multiSearchRequest, highLevelClient()::multiSearch, highLevelClient()::multiSearchAsync,
|
||||
highLevelClient()::multiSearch, highLevelClient()::multiSearchAsync);
|
||||
execute(multiSearchRequest, highLevelClient()::multiSearch, highLevelClient()::multiSearchAsync);
|
||||
assertThat(multiSearchResponse.getTook().millis(), Matchers.greaterThanOrEqualTo(0L));
|
||||
assertThat(multiSearchResponse.getResponses().length, Matchers.equalTo(3));
|
||||
|
||||
|
@ -744,8 +725,7 @@ public class SearchIT extends ESRestHighLevelClientTestCase {
|
|||
multiSearchRequest.add(searchRequest2);
|
||||
|
||||
MultiSearchResponse multiSearchResponse =
|
||||
execute(multiSearchRequest, highLevelClient()::multiSearch, highLevelClient()::multiSearchAsync,
|
||||
highLevelClient()::multiSearch, highLevelClient()::multiSearchAsync);
|
||||
execute(multiSearchRequest, highLevelClient()::multiSearch, highLevelClient()::multiSearchAsync);
|
||||
assertThat(multiSearchResponse.getTook().millis(), Matchers.greaterThanOrEqualTo(0L));
|
||||
assertThat(multiSearchResponse.getResponses().length, Matchers.equalTo(2));
|
||||
|
||||
|
|
|
@ -746,7 +746,7 @@ public class CRUDDocumentationIT extends ESRestHighLevelClientTestCase {
|
|||
listener = new LatchedActionListener<>(listener, latch);
|
||||
|
||||
// tag::bulk-execute-async
|
||||
client.bulkAsync(request, listener); // <1>
|
||||
client.bulkAsync(request, RequestOptions.DEFAULT, listener); // <1>
|
||||
// end::bulk-execute-async
|
||||
|
||||
assertTrue(latch.await(30L, TimeUnit.SECONDS));
|
||||
|
@ -995,8 +995,9 @@ public class CRUDDocumentationIT extends ESRestHighLevelClientTestCase {
|
|||
}
|
||||
};
|
||||
|
||||
BulkProcessor bulkProcessor =
|
||||
BulkProcessor.builder(client::bulkAsync, listener).build(); // <5>
|
||||
BulkProcessor bulkProcessor = BulkProcessor.builder(
|
||||
(request, bulkListener) -> client.bulkAsync(request, RequestOptions.DEFAULT, bulkListener),
|
||||
listener).build(); // <5>
|
||||
// end::bulk-processor-init
|
||||
assertNotNull(bulkProcessor);
|
||||
|
||||
|
@ -1054,7 +1055,8 @@ public class CRUDDocumentationIT extends ESRestHighLevelClientTestCase {
|
|||
// end::bulk-processor-listener
|
||||
|
||||
// tag::bulk-processor-options
|
||||
BulkProcessor.Builder builder = BulkProcessor.builder(client::bulkAsync, listener);
|
||||
BulkProcessor.Builder builder = BulkProcessor.builder(
|
||||
(request, bulkListener) -> client.bulkAsync(request, RequestOptions.DEFAULT, bulkListener), listener);
|
||||
builder.setBulkActions(500); // <1>
|
||||
builder.setBulkSize(new ByteSizeValue(1L, ByteSizeUnit.MB)); // <2>
|
||||
builder.setConcurrentRequests(0); // <3>
|
||||
|
@ -1175,7 +1177,7 @@ public class CRUDDocumentationIT extends ESRestHighLevelClientTestCase {
|
|||
listener = new LatchedActionListener<>(listener, latch);
|
||||
|
||||
// tag::multi-get-execute-async
|
||||
client.multiGetAsync(request, listener); // <1>
|
||||
client.multiGetAsync(request, RequestOptions.DEFAULT, listener); // <1>
|
||||
// end::multi-get-execute-async
|
||||
|
||||
assertTrue(latch.await(30L, TimeUnit.SECONDS));
|
||||
|
|
|
@ -576,7 +576,7 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|||
RestHighLevelClient client = highLevelClient();
|
||||
|
||||
{
|
||||
CreateIndexResponse createIndexResponse = client.indices().create(new CreateIndexRequest("twitter"));
|
||||
CreateIndexResponse createIndexResponse = client.indices().create(new CreateIndexRequest("twitter"), RequestOptions.DEFAULT);
|
||||
assertTrue(createIndexResponse.isAcknowledged());
|
||||
PutMappingRequest request = new PutMappingRequest("twitter");
|
||||
request.type("tweet");
|
||||
|
@ -589,7 +589,7 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|||
" }\n" +
|
||||
"}", // <1>
|
||||
XContentType.JSON);
|
||||
PutMappingResponse putMappingResponse = client.indices().putMapping(request);
|
||||
PutMappingResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT);
|
||||
assertTrue(putMappingResponse.isAcknowledged());
|
||||
}
|
||||
|
||||
|
@ -633,7 +633,7 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|||
final RestHighLevelClient client = highLevelClient();
|
||||
|
||||
{
|
||||
CreateIndexResponse createIndexResponse = client.indices().create(new CreateIndexRequest("twitter"));
|
||||
CreateIndexResponse createIndexResponse = client.indices().create(new CreateIndexRequest("twitter"), RequestOptions.DEFAULT);
|
||||
assertTrue(createIndexResponse.isAcknowledged());
|
||||
PutMappingRequest request = new PutMappingRequest("twitter");
|
||||
request.type("tweet");
|
||||
|
@ -646,7 +646,7 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|||
" }\n" +
|
||||
"}", // <1>
|
||||
XContentType.JSON);
|
||||
PutMappingResponse putMappingResponse = client.indices().putMapping(request);
|
||||
PutMappingResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT);
|
||||
assertTrue(putMappingResponse.isAcknowledged());
|
||||
}
|
||||
|
||||
|
@ -1733,7 +1733,8 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|||
RestHighLevelClient client = highLevelClient();
|
||||
|
||||
{
|
||||
CreateIndexResponse createIndexResponse = client.indices().create(new CreateIndexRequest("index").alias(new Alias("alias")));
|
||||
CreateIndexResponse createIndexResponse = client.indices().create(new CreateIndexRequest("index").alias(new Alias("alias")),
|
||||
RequestOptions.DEFAULT);
|
||||
assertTrue(createIndexResponse.isAcknowledged());
|
||||
}
|
||||
|
||||
|
|
|
@ -628,7 +628,7 @@ public class SearchDocumentationIT extends ESRestHighLevelClientTestCase {
|
|||
scrollListener = new LatchedActionListener<>(scrollListener, latch);
|
||||
|
||||
// tag::search-scroll-execute-async
|
||||
client.searchScrollAsync(scrollRequest, scrollListener); // <1>
|
||||
client.searchScrollAsync(scrollRequest, RequestOptions.DEFAULT, scrollListener); // <1>
|
||||
// end::search-scroll-execute-async
|
||||
|
||||
assertTrue(latch.await(30L, TimeUnit.SECONDS));
|
||||
|
|
|
@ -36,6 +36,7 @@ Elasticsearch 6.x in order to be readable by Elasticsearch 7.x.
|
|||
* <<breaking_70_settings_changes>>
|
||||
* <<breaking_70_scripting_changes>>
|
||||
* <<breaking_70_snapshotstats_changes>>
|
||||
* <<breaking_70_restclient_changes>>
|
||||
|
||||
include::migrate_7_0/aggregations.asciidoc[]
|
||||
include::migrate_7_0/analysis.asciidoc[]
|
||||
|
@ -49,4 +50,5 @@ include::migrate_7_0/api.asciidoc[]
|
|||
include::migrate_7_0/java.asciidoc[]
|
||||
include::migrate_7_0/settings.asciidoc[]
|
||||
include::migrate_7_0/scripting.asciidoc[]
|
||||
include::migrate_7_0/snapshotstats.asciidoc[]
|
||||
include::migrate_7_0/snapshotstats.asciidoc[]
|
||||
include::migrate_7_0/restclient.asciidoc[]
|
|
@ -0,0 +1,13 @@
|
|||
[[breaking_70_restclient_changes]]
|
||||
=== High-level REST client changes
|
||||
|
||||
==== API methods accepting `Header` argument have been removed
|
||||
|
||||
All API methods accepting headers as a `Header` varargs argument, deprecated
|
||||
since 6.4, have been removed in favour of the newly introduced methods that
|
||||
accept instead a `RequestOptions` argument. In case you are not specifying any
|
||||
header, e.g. `client.index(indexRequest)` becomes
|
||||
`client.index(indexRequest, RequestOptions.DEFAULT)`.
|
||||
In case you are specifying headers
|
||||
e.g. `client.index(indexRequest, new Header("name" "value"))` becomes
|
||||
`client.index(indexRequest, RequestOptions.DEFAULT.toBuilder().addHeader("name", "value").build());`
|
Loading…
Reference in New Issue