Class ElasticsearchRestTemplate
java.lang.Object
org.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate
org.springframework.data.elasticsearch.client.erhlc.ElasticsearchRestTemplate
- All Implemented Interfaces:
Aware,ApplicationContextAware,DocumentOperations,ElasticsearchOperations,SearchOperations
Deprecated.
since 5.0
ElasticsearchRestTemplate
- Since:
- 4.4
- Author:
- Rizwan Idrees, Mohsin Husen, Artur Konczak, Kevin Leturc, Mason Chan, Young Gu, Oliver Gierke, Mark Janssen, Chris White, Mark Paluch, Ilkang Na, Alen Turkovic, Sascha Woo, Ted Liang, Don Wellington, Zetang Zeng, Peter Nowak, Ivan Greene, Christoph Strobl, Lorenzo Spinelli, Dmitriy Yakovlev, Roman Puchkovskiy, Martin Choraine, Farid Azaza, Peter-Josef Meisch, Mathias Teier, Gyula Attila Csorogi, Massimiliano Poggi, Farid Faoudi, Sijia Liu
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceDeprecated.Callback interface to be used withexecute(ClientCallback)for operating directly onRestHighLevelClient.Nested classes/interfaces inherited from class org.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate
AbstractElasticsearchTemplate.DocumentCallback<T>, AbstractElasticsearchTemplate.ReadDocumentCallback<T>, AbstractElasticsearchTemplate.ReadSearchDocumentResponseCallback<T>, AbstractElasticsearchTemplate.ReadSearchScrollDocumentResponseCallback<T>, AbstractElasticsearchTemplate.SearchDocumentResponseCallback<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.data.elasticsearch.client.erhlc.RequestFactoryDeprecated.Fields inherited from class org.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate
elasticsearchConverter, entityCallbacks, entityOperations, refreshPolicy, routingResolver -
Constructor Summary
ConstructorsConstructorDescriptionElasticsearchRestTemplate(org.elasticsearch.client.RestHighLevelClient client) Deprecated.ElasticsearchRestTemplate(org.elasticsearch.client.RestHighLevelClient client, ElasticsearchConverter elasticsearchConverter) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionvoidbulkUpdate(List<UpdateQuery> queries, BulkOptions bulkOptions, IndexCoordinates index) Deprecated.Bulk update all objects.protected List<IndexedObjectInformation>checkForBulkOperationFailure(org.elasticsearch.action.bulk.BulkResponse bulkResponse) Deprecated.extract the list ofIndexedObjectInformationfrom aBulkResponse.cluster()Deprecated.return aClusterOperationsinstance that uses the same client communication setup as this ElasticsearchOperations instance.longcount(Query query, Class<?> clazz, IndexCoordinates index) Deprecated.return number of elements found by given querydelete(Query query, Class<?> clazz, IndexCoordinates index) Deprecated.Delete all records matching the query.doBulkOperation(List<?> queries, BulkOptions bulkOptions, IndexCoordinates index) Deprecated.protected AbstractElasticsearchTemplatedoCopy()Deprecated.must return a copy of this instance that will for example be used to set a custom routing resolver without modifying the original object.protected StringdoDelete(String id, String routing, IndexCoordinates index) Deprecated.protected booleandoExists(String id, IndexCoordinates index) Deprecated.doIndex(IndexQuery query, IndexCoordinates index) Deprecated.protected <T> SearchHits<T>doSearch(MoreLikeThisQuery query, Class<T> clazz, IndexCoordinates index) Deprecated.<T> Texecute(ElasticsearchRestTemplate.ClientCallback<T> callback) Deprecated.Execute a callback with theRestHighLevelClient<T> Tget(String id, Class<T> clazz, IndexCoordinates index) Deprecated.Retrieves an object from the index specified in the entity's Document annotation.Deprecated.tries to extract the version of the Elasticsearch clusterprotected org.elasticsearch.action.search.MultiSearchResponse.Item[]getMultiSearchResult(org.elasticsearch.action.search.MultiSearchRequest request) Deprecated.org.springframework.data.elasticsearch.client.erhlc.RequestFactoryDeprecated.Deprecated.Deprecated.Deprecated.Creates aQueryto find get all documents with given ids.Deprecated.get anIndexOperationsthat is bound to the given classindexOps(IndexCoordinates index) Deprecated.get anIndexOperationsthat is bound to the given indexDeprecated.Creates aQueryto get all documents.<T> List<MultiGetItem<T>>multiGet(Query query, Class<T> clazz, IndexCoordinates index) Deprecated.Execute a multiGet against elasticsearch for the given ids.<T> List<SearchHits<T>>multiSearch(List<? extends Query> queries, Class<T> clazz, IndexCoordinates index) Deprecated.Execute the multi search query against elasticsearch and return result asListofSearchHits.List<SearchHits<?>>multiSearch(List<? extends Query> queries, List<Class<?>> classes) Deprecated.Execute the multi search query against elasticsearch and return result asListofSearchHits.List<SearchHits<?>>multiSearch(List<? extends Query> queries, List<Class<?>> classes, IndexCoordinates index) Deprecated.Execute the multi search query against elasticsearch and return result asListofSearchHits.protected <R extends org.elasticsearch.action.support.WriteRequest<R>>
RprepareWriteRequest(R request) Deprecated.Preprocess the write request before it is sent to the server, e.g. by setting therefresh policyif applicable.reindex(ReindexRequest reindexRequest) Deprecated.Copies documents from a source to a destination.<T> SearchHits<T>search(Query query, Class<T> clazz, IndexCoordinates index) Deprecated.Execute the criteria query against elasticsearch and return result asSearchHitsvoidsearchScrollClear(List<String> scrollIds) Deprecated.<T> SearchScrollHits<T>searchScrollContinue(String scrollId, long scrollTimeInMillis, Class<T> clazz, IndexCoordinates index) Deprecated.<T> SearchScrollHits<T>searchScrollStart(long scrollTimeInMillis, Query query, Class<T> clazz, IndexCoordinates index) Deprecated.submitReindex(ReindexRequest reindexRequest) Deprecated.Submits a reindex task.org.elasticsearch.action.search.SearchResponseDeprecated.org.elasticsearch.action.search.SearchResponsesuggest(org.elasticsearch.search.suggest.SuggestBuilder suggestion, IndexCoordinates index) Deprecated.update(UpdateQuery query, IndexCoordinates index) Deprecated.Partial update of the document.updateByQuery(UpdateQuery query, IndexCoordinates index) Deprecated.Update document(s) by queryMethods inherited from class org.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate
buildUpdateQueryByEntity, bulkIndex, bulkIndex, bulkIndex, bulkOperation, bulkUpdate, closePointInTime, count, delete, delete, delete, delete, delete, exists, exists, get, getElasticsearchConverter, getEntityCreator, getEntityRouting, getIndexCoordinatesFor, getRefreshPolicy, index, logVersions, maybeCallbackAfterConvert, maybeCallbackAfterLoad, maybeCallbackAfterSave, maybeCallbackAfterSaveWithQueries, maybeCallbackAfterSaveWithQuery, maybeCallbackBeforeConvert, maybeCallbackBeforeConvertWithQueries, maybeCallbackBeforeConvertWithQuery, multiGet, multiSearch, openPointInTime, save, save, save, save, save, search, search, search, searchForStream, searchForStream, searchScrollClear, setApplicationContext, setEntityCallbacks, setRefreshPolicy, toArray, update, updateIndexedObject, updateIndexedObjectsWithQueries, withRoutingMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.data.elasticsearch.core.DocumentOperations
bulkIndex, bulkUpdateMethods inherited from interface org.springframework.data.elasticsearch.core.ElasticsearchOperations
convertId, stringIdRepresentationMethods inherited from interface org.springframework.data.elasticsearch.core.SearchOperations
count, openPointInTime, searchOne, searchOne
-
Field Details
-
requestFactory
protected org.springframework.data.elasticsearch.client.erhlc.RequestFactory requestFactoryDeprecated.
-
-
Constructor Details
-
ElasticsearchRestTemplate
public ElasticsearchRestTemplate(org.elasticsearch.client.RestHighLevelClient client) Deprecated. -
ElasticsearchRestTemplate
public ElasticsearchRestTemplate(org.elasticsearch.client.RestHighLevelClient client, ElasticsearchConverter elasticsearchConverter) Deprecated.
-
-
Method Details
-
doCopy
Deprecated.Description copied from class:AbstractElasticsearchTemplatemust return a copy of this instance that will for example be used to set a custom routing resolver without modifying the original object.- Specified by:
doCopyin classAbstractElasticsearchTemplate
-
getRequestFactory
public org.springframework.data.elasticsearch.client.erhlc.RequestFactory getRequestFactory()Deprecated.- Since:
- 4.0
-
indexOps
Deprecated.Description copied from interface:ElasticsearchOperationsget anIndexOperationsthat is bound to the given class- Returns:
- IndexOperations
-
indexOps
Deprecated.Description copied from interface:ElasticsearchOperationsget anIndexOperationsthat is bound to the given index- Returns:
- IndexOperations
-
cluster
Deprecated.Description copied from interface:ElasticsearchOperationsreturn aClusterOperationsinstance that uses the same client communication setup as this ElasticsearchOperations instance.- Returns:
- ClusterOperations implementation
-
doIndex
Deprecated.- Specified by:
doIndexin classAbstractElasticsearchTemplate
-
get
Deprecated.Description copied from interface:DocumentOperationsRetrieves an object from the index specified in the entity's Document annotation.- Parameters:
id- the id of the objectclazz- the entity class,index- the index from which the object is read.- Returns:
- the entity
-
multiGet
Deprecated.Description copied from interface:DocumentOperationsExecute a multiGet against elasticsearch for the given ids.- Parameters:
query- the query defining the ids of the objects to getclazz- the type of the object to be returnedindex- the index(es) from which the objects are read.- Returns:
- list of
MultiGetItems - See Also:
-
doExists
Deprecated.- Specified by:
doExistsin classAbstractElasticsearchTemplate
-
bulkUpdate
Deprecated.Description copied from interface:DocumentOperationsBulk update all objects. Will do update.- Parameters:
queries- the queries to execute in bulkbulkOptions- options to be added to the bulk request
-
doDelete
Deprecated.- Specified by:
doDeletein classAbstractElasticsearchTemplate
-
delete
Deprecated.Description copied from interface:DocumentOperationsDelete all records matching the query.- Parameters:
query- query defining the objectsclazz- The entity class, must be annotated withDocumentindex- the index from which to delete- Returns:
- response with detailed information
-
update
Deprecated.Description copied from interface:DocumentOperationsPartial update of the document.- Parameters:
query- query defining the updateindex- the index where to update the records- Returns:
- the update response
-
updateByQuery
Deprecated.Description copied from interface:DocumentOperationsUpdate document(s) by query- Parameters:
query- query defining the update, must not be nullindex- the index where to update the records , must not be null- Returns:
- the update response
-
reindex
Deprecated.Description copied from interface:DocumentOperationsCopies documents from a source to a destination. The source can be any existing index, alias, or data stream. The destination must differ from the source. For example, you cannot reindex a data stream into itself. (@see https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html)- Parameters:
reindexRequest- reindex request parameters- Returns:
- the reindex response
-
submitReindex
Deprecated.Description copied from interface:DocumentOperationsSubmits a reindex task. (@see https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html)- Parameters:
reindexRequest- reindex request parameters- Returns:
- the task id
-
doBulkOperation
public List<IndexedObjectInformation> doBulkOperation(List<?> queries, BulkOptions bulkOptions, IndexCoordinates index) Deprecated.- Specified by:
doBulkOperationin classAbstractElasticsearchTemplate
-
prepareWriteRequest
protected <R extends org.elasticsearch.action.support.WriteRequest<R>> R prepareWriteRequest(R request) Deprecated.Preprocess the write request before it is sent to the server, e.g. by setting therefresh policyif applicable.- Type Parameters:
R- the request type- Parameters:
request- must not be null.- Returns:
- the processed
WriteRequest.
-
checkForBulkOperationFailure
protected List<IndexedObjectInformation> checkForBulkOperationFailure(org.elasticsearch.action.bulk.BulkResponse bulkResponse) Deprecated.extract the list ofIndexedObjectInformationfrom aBulkResponse.- Parameters:
bulkResponse- the response to evaluate- Returns:
- the list of the
IndexedObjectInformations
-
count
Deprecated.Description copied from interface:SearchOperationsreturn number of elements found by given query- Parameters:
query- the query to executeclazz- the entity clazz used for property mappingindex- the index to run the query against- Returns:
- count
-
search
Deprecated.Description copied from interface:SearchOperationsExecute the criteria query against elasticsearch and return result asSearchHits- Type Parameters:
T- element return type- Parameters:
query- the query to executeclazz- the entity clazz used for property mappingindex- the index to run the query against- Returns:
- SearchHits containing the list of found objects
-
doSearch
protected <T> SearchHits<T> doSearch(MoreLikeThisQuery query, Class<T> clazz, IndexCoordinates index) Deprecated.- Specified by:
doSearchin classAbstractElasticsearchTemplate
-
searchScrollStart
public <T> SearchScrollHits<T> searchScrollStart(long scrollTimeInMillis, Query query, Class<T> clazz, IndexCoordinates index) Deprecated.- Specified by:
searchScrollStartin classAbstractElasticsearchTemplate
-
searchScrollContinue
public <T> SearchScrollHits<T> searchScrollContinue(String scrollId, long scrollTimeInMillis, Class<T> clazz, IndexCoordinates index) Deprecated.- Specified by:
searchScrollContinuein classAbstractElasticsearchTemplate
-
searchScrollClear
Deprecated.- Specified by:
searchScrollClearin classAbstractElasticsearchTemplate
-
suggest
public org.elasticsearch.action.search.SearchResponse suggest(org.elasticsearch.search.suggest.SuggestBuilder suggestion, IndexCoordinates index) Deprecated. -
multiSearch
public <T> List<SearchHits<T>> multiSearch(List<? extends Query> queries, Class<T> clazz, IndexCoordinates index) Deprecated.Description copied from interface:SearchOperationsExecute the multi search query against elasticsearch and return result asListofSearchHits.- Type Parameters:
T- element return type- Parameters:
queries- the queries to executeclazz- the entity clazz used for property mappingindex- the index to run the query against- Returns:
- list of SearchHits
-
multiSearch
Deprecated.Description copied from interface:SearchOperationsExecute the multi search query against elasticsearch and return result asListofSearchHits.- Parameters:
queries- the queries to executeclasses- the entity classes- Returns:
- list of SearchHits
-
multiSearch
public List<SearchHits<?>> multiSearch(List<? extends Query> queries, List<Class<?>> classes, IndexCoordinates index) Deprecated.Description copied from interface:SearchOperationsExecute the multi search query against elasticsearch and return result asListofSearchHits.- Parameters:
queries- the queries to executeclasses- the entity classes used for property mappingindex- the index to run the query against- Returns:
- list of SearchHits
-
getMultiSearchResult
protected org.elasticsearch.action.search.MultiSearchResponse.Item[] getMultiSearchResult(org.elasticsearch.action.search.MultiSearchRequest request) Deprecated. -
execute
Deprecated.Execute a callback with theRestHighLevelClient- Type Parameters:
T- the type returned from the callback- Parameters:
callback- the callback to execute, must not be null- Returns:
- the callback result
- Since:
- 4.0
-
getClusterVersion
Deprecated.Description copied from class:AbstractElasticsearchTemplatetries to extract the version of the Elasticsearch cluster- Specified by:
getClusterVersionin classAbstractElasticsearchTemplate- Returns:
- the version as string if it can be retrieved
-
matchAllQuery
Deprecated.Description copied from interface:SearchOperationsCreates aQueryto get all documents. Must be implemented by the concrete implementations to provide an appropriate query using the respective client.- Returns:
- a query to find all documents
-
idsQuery
Deprecated.Description copied from interface:SearchOperationsCreates aQueryto find get all documents with given ids. Must be implemented by the concrete implementations to provide an appropriate query using the respective client.- Parameters:
ids- the list of ids must not be null- Returns:
- query returning the documents with the given ids
-
getVendor
Deprecated.- Specified by:
getVendorin classAbstractElasticsearchTemplate- Returns:
- the vendor name of the used cluster and client library
-
getRuntimeLibraryVersion
Deprecated.- Specified by:
getRuntimeLibraryVersionin classAbstractElasticsearchTemplate- Returns:
- the version of the used client runtime library.
-
suggest
@Deprecated public org.elasticsearch.action.search.SearchResponse suggest(org.elasticsearch.search.suggest.SuggestBuilder suggestion, Class<?> clazz) Deprecated.
-