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
,ScriptOperations
,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, Hamid Rahimi
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Deprecated.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
Modifier and TypeFieldDescriptionprotected org.springframework.data.elasticsearch.client.erhlc.RequestFactory
Deprecated.Fields inherited from class org.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate
elasticsearchConverter, entityCallbacks, entityOperations, refreshPolicy, routingResolver
-
Constructor Summary
ConstructorDescriptionElasticsearchRestTemplate
(org.elasticsearch.client.RestHighLevelClient client) Deprecated.ElasticsearchRestTemplate
(org.elasticsearch.client.RestHighLevelClient client, ElasticsearchConverter elasticsearchConverter) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionvoid
bulkUpdate
(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 ofIndexedObjectInformation
from aBulkResponse
.cluster()
Deprecated.return aClusterOperations
instance that uses the same client communication setup as this ElasticsearchOperations instance.long
count
(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 AbstractElasticsearchTemplate
doCopy()
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 String
doDelete
(String id, String routing, IndexCoordinates index) Deprecated.protected boolean
doExists
(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> T
execute
(ElasticsearchRestTemplate.ClientCallback<T> callback) Deprecated.Execute a callback with theRestHighLevelClient
<T> T
get
(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.RequestFactory
Deprecated.Deprecated.Deprecated.Deprecated.Creates aQuery
to find get all documents with given ids.Deprecated.get anIndexOperations
that is bound to the given classindexOps
(IndexCoordinates index) Deprecated.get anIndexOperations
that is bound to the given indexDeprecated.Creates aQuery
to 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 asList
ofSearchHits
.List<SearchHits<?>>
multiSearch
(List<? extends Query> queries, List<Class<?>> classes) Deprecated.Execute the multi search query against elasticsearch and return result asList
ofSearchHits
.List<SearchHits<?>>
multiSearch
(List<? extends Query> queries, List<Class<?>> classes, List<IndexCoordinates> indexes) Deprecated.Execute the multi search query against elasticsearch and return result asList
ofSearchHits
.List<SearchHits<?>>
multiSearch
(List<? extends Query> queries, List<Class<?>> classes, IndexCoordinates index) Deprecated.Execute the multi search query against elasticsearch and return result asList
ofSearchHits
.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 policy
if 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 asSearchHits
void
searchScrollClear
(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.SearchResponse
Deprecated.org.elasticsearch.action.search.SearchResponse
suggest
(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, deleteScript, exists, exists, get, getElasticsearchConverter, getEntityCreator, getEntityRouting, getIndexCoordinatesFor, getRefreshPolicy, getScript, index, logVersions, maybeCallbackAfterConvert, maybeCallbackAfterLoad, maybeCallbackAfterSave, maybeCallbackAfterSaveWithQueries, maybeCallbackAfterSaveWithQuery, maybeCallbackBeforeConvert, maybeCallbackBeforeConvertWithQueries, maybeCallbackBeforeConvertWithQuery, multiGet, multiSearch, openPointInTime, putScript, save, save, save, save, save, search, search, search, searchForStream, searchForStream, searchScrollClear, setApplicationContext, setEntityCallbacks, setRefreshPolicy, toArray, update, update, updateIndexedObject, updateIndexedObjectsWithQueries, withRouting
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.data.elasticsearch.core.DocumentOperations
bulkIndex, bulkUpdate
Methods inherited from interface org.springframework.data.elasticsearch.core.ElasticsearchOperations
convertId, stringIdRepresentation
Methods 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:AbstractElasticsearchTemplate
must 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:
doCopy
in classAbstractElasticsearchTemplate
-
getRequestFactory
public org.springframework.data.elasticsearch.client.erhlc.RequestFactory getRequestFactory()Deprecated.- Since:
- 4.0
-
indexOps
Deprecated.Description copied from interface:ElasticsearchOperations
get anIndexOperations
that is bound to the given class- Returns:
- IndexOperations
-
indexOps
Deprecated.Description copied from interface:ElasticsearchOperations
get anIndexOperations
that is bound to the given index- Returns:
- IndexOperations
-
cluster
Deprecated.Description copied from interface:ElasticsearchOperations
return aClusterOperations
instance that uses the same client communication setup as this ElasticsearchOperations instance.- Returns:
- ClusterOperations implementation
-
doIndex
Deprecated.- Specified by:
doIndex
in classAbstractElasticsearchTemplate
-
get
Deprecated.Description copied from interface:DocumentOperations
Retrieves 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:DocumentOperations
Execute 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
MultiGetItem
s - See Also:
-
doExists
Deprecated.- Specified by:
doExists
in classAbstractElasticsearchTemplate
-
bulkUpdate
Deprecated.Description copied from interface:DocumentOperations
Bulk 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:
doDelete
in classAbstractElasticsearchTemplate
-
delete
Deprecated.Description copied from interface:DocumentOperations
Delete all records matching the query.- Parameters:
query
- query defining the objectsclazz
- The entity class, must be annotated withDocument
index
- the index from which to delete- Returns:
- response with detailed information
-
update
Deprecated.Description copied from interface:DocumentOperations
Partial 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:DocumentOperations
Update 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:DocumentOperations
Copies 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:DocumentOperations
Submits 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:
doBulkOperation
in 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 policy
if 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 ofIndexedObjectInformation
from aBulkResponse
.- Parameters:
bulkResponse
- the response to evaluate- Returns:
- the list of the
IndexedObjectInformation
s
-
count
Deprecated.Description copied from interface:SearchOperations
return 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:SearchOperations
Execute 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:
doSearch
in classAbstractElasticsearchTemplate
-
searchScrollStart
public <T> SearchScrollHits<T> searchScrollStart(long scrollTimeInMillis, Query query, Class<T> clazz, IndexCoordinates index) Deprecated.- Specified by:
searchScrollStart
in classAbstractElasticsearchTemplate
-
searchScrollContinue
public <T> SearchScrollHits<T> searchScrollContinue(String scrollId, long scrollTimeInMillis, Class<T> clazz, IndexCoordinates index) Deprecated.- Specified by:
searchScrollContinue
in classAbstractElasticsearchTemplate
-
searchScrollClear
Deprecated.- Specified by:
searchScrollClear
in 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:SearchOperations
Execute the multi search query against elasticsearch and return result asList
ofSearchHits
.- 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:SearchOperations
Execute the multi search query against elasticsearch and return result asList
ofSearchHits
.- 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:SearchOperations
Execute the multi search query against elasticsearch and return result asList
ofSearchHits
.- Parameters:
queries
- the queries to executeclasses
- the entity classes used for property mappingindex
- the index to run the queries against- Returns:
- list of SearchHits
-
multiSearch
public List<SearchHits<?>> multiSearch(List<? extends Query> queries, List<Class<?>> classes, List<IndexCoordinates> indexes) Deprecated.Description copied from interface:SearchOperations
Execute the multi search query against elasticsearch and return result asList
ofSearchHits
.- Parameters:
queries
- the queries to executeclasses
- the entity classes used for property mappingindexes
- the indexes to run the queries 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:AbstractElasticsearchTemplate
tries to extract the version of the Elasticsearch cluster- Specified by:
getClusterVersion
in classAbstractElasticsearchTemplate
- Returns:
- the version as string if it can be retrieved
-
matchAllQuery
Deprecated.Description copied from interface:SearchOperations
Creates aQuery
to 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:SearchOperations
Creates aQuery
to 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:
getVendor
in classAbstractElasticsearchTemplate
- Returns:
- the vendor name of the used cluster and client library
-
getRuntimeLibraryVersion
Deprecated.- Specified by:
getRuntimeLibraryVersion
in 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.
-