public class ElasticsearchRestTemplate extends AbstractElasticsearchTemplate
| Modifier and Type | Class and Description |
|---|---|
static interface |
ElasticsearchRestTemplate.ClientCallback<T>
Callback interface to be used with
execute(ClientCallback) for operating directly on
RestHighLevelClient. |
AbstractElasticsearchTemplate.DocumentCallback<T>, AbstractElasticsearchTemplate.ReadDocumentCallback<T>, AbstractElasticsearchTemplate.ReadSearchDocumentResponseCallback<T>, AbstractElasticsearchTemplate.ReadSearchScrollDocumentResponseCallback<T>, AbstractElasticsearchTemplate.SearchDocumentResponseCallback<T>elasticsearchConverter, requestFactory| Constructor and Description |
|---|
ElasticsearchRestTemplate(org.elasticsearch.client.RestHighLevelClient client) |
ElasticsearchRestTemplate(org.elasticsearch.client.RestHighLevelClient client,
ElasticsearchConverter elasticsearchConverter) |
| Modifier and Type | Method and Description |
|---|---|
void |
bulkUpdate(List<UpdateQuery> queries,
BulkOptions bulkOptions,
IndexCoordinates index)
Bulk update all objects.
|
long |
count(Query query,
Class<?> clazz,
IndexCoordinates index)
return number of elements found by given query
|
void |
delete(DeleteQuery deleteQuery,
IndexCoordinates index)
Deprecated.
|
void |
delete(Query query,
Class<?> clazz,
IndexCoordinates index)
Delete all records matching the query.
|
String |
delete(String id,
String routing,
IndexCoordinates index)
Delete the one object with provided id.
|
List<IndexedObjectInformation> |
doBulkOperation(List<?> queries,
BulkOptions bulkOptions,
IndexCoordinates index) |
protected boolean |
doExists(String id,
IndexCoordinates index) |
String |
doIndex(IndexQuery query,
IndexCoordinates index) |
<T> T |
execute(ElasticsearchRestTemplate.ClientCallback<T> callback)
Execute a callback with the
RestHighLevelClient |
<T> T |
get(String id,
Class<T> clazz,
IndexCoordinates index)
Retrieves an object from the index specified in the entity's Document annotation.
|
protected String |
getClusterVersion()
tries to extract the version of the Elasticsearch cluster
|
protected org.elasticsearch.action.search.MultiSearchResponse.Item[] |
getMultiSearchResult(org.elasticsearch.action.search.MultiSearchRequest request) |
IndexOperations |
indexOps(Class<?> clazz)
get an
IndexOperations that is bound to the given class |
IndexOperations |
indexOps(IndexCoordinates index)
get an
IndexOperations that is bound to the given index |
<T> List<T> |
multiGet(Query query,
Class<T> clazz,
IndexCoordinates index)
Execute a multiGet against elasticsearch for the given ids.
|
<T> SearchHits<T> |
search(Query query,
Class<T> clazz,
IndexCoordinates index)
Execute the criteria query against elasticsearch and return result as
SearchHits |
void |
searchScrollClear(List<String> scrollIds) |
<T> SearchScrollHits<T> |
searchScrollContinue(String scrollId,
long scrollTimeInMillis,
Class<T> clazz,
IndexCoordinates index) |
<T> SearchScrollHits<T> |
searchScrollStart(long scrollTimeInMillis,
Query query,
Class<T> clazz,
IndexCoordinates index) |
org.elasticsearch.action.search.SearchResponse |
suggest(org.elasticsearch.search.suggest.SuggestBuilder suggestion,
IndexCoordinates index)
Does a suggest query
|
UpdateResponse |
update(UpdateQuery query,
IndexCoordinates index)
Partial update of the document.
|
bulkIndex, bulkIndex, bulkIndex, bulkOperation, bulkUpdate, checkForBulkOperationFailure, count, createElasticsearchConverter, delete, delete, delete, delete, exists, exists, get, get, getElasticsearchConverter, getEntityRouting, getIndexCoordinatesFor, getRequestFactory, index, initialize, maybeCallbackAfterConvert, maybeCallbackAfterSave, maybeCallbackAfterSaveWithQueries, maybeCallbackAfterSaveWithQuery, maybeCallbackBeforeConvert, maybeCallbackBeforeConvertWithQueries, maybeCallbackBeforeConvertWithQuery, multiGet, multiSearch, multiSearch, multiSearch, multiSearch, queryForObject, save, save, save, save, save, search, search, search, searchForStream, searchForStream, searchScrollClear, setApplicationContext, setEntityCallbacks, stream, suggest, toArray, updateIndexedObject, updateIndexedObjectsWithQueriesclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddAlias, createIndex, createIndex, createIndex, createIndex, deleteIndex, deleteIndex, deleteIndex, getDocument, getMapping, getMapping, getSetting, getSetting, getSettings, getSettings, indexExists, indexExists, putMapping, putMapping, putMapping, putMapping, queryForAlias, refresh, refresh, removeAlias, stringIdRepresentationbulkIndex, bulkUpdate, deletecount, moreLikeThis, queryForIds, queryForList, queryForList, queryForList, queryForObject, queryForPage, queryForPage, queryForPage, searchOne, searchOnepublic ElasticsearchRestTemplate(org.elasticsearch.client.RestHighLevelClient client)
public ElasticsearchRestTemplate(org.elasticsearch.client.RestHighLevelClient client,
ElasticsearchConverter elasticsearchConverter)
public IndexOperations indexOps(Class<?> clazz)
ElasticsearchOperationsIndexOperations that is bound to the given classpublic IndexOperations indexOps(IndexCoordinates index)
ElasticsearchOperationsIndexOperations that is bound to the given indexpublic String doIndex(IndexQuery query, IndexCoordinates index)
doIndex in class AbstractElasticsearchTemplate@Nullable public <T> T get(String id, Class<T> clazz, IndexCoordinates index)
DocumentOperationsid - the id of the objectclazz - the entity class,index - the index from which the object is read.public <T> List<T> multiGet(Query query, Class<T> clazz, IndexCoordinates index)
DocumentOperationsquery - 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.protected boolean doExists(String id, IndexCoordinates index)
doExists in class AbstractElasticsearchTemplatepublic void bulkUpdate(List<UpdateQuery> queries, BulkOptions bulkOptions, IndexCoordinates index)
DocumentOperationsqueries - the queries to execute in bulkbulkOptions - options to be added to the bulk requestpublic String delete(String id, @Nullable String routing, IndexCoordinates index)
DocumentOperationsid - the document to deleterouting - the optional routing for the document to be deletedindex - the index from which to deletepublic void delete(Query query, Class<?> clazz, IndexCoordinates index)
DocumentOperationsquery - query defining the objectsclazz - The entity class, must be annotated with
Documentindex - the index from which to delete@Deprecated public void delete(DeleteQuery deleteQuery, IndexCoordinates index)
DocumentOperationsdeleteQuery - query defining the objectsindex - the index where to delete the recordspublic UpdateResponse update(UpdateQuery query, IndexCoordinates index)
DocumentOperationsquery - query defining the updateindex - the index where to update the recordspublic List<IndexedObjectInformation> doBulkOperation(List<?> queries, BulkOptions bulkOptions, IndexCoordinates index)
doBulkOperation in class AbstractElasticsearchTemplatepublic long count(Query query, @Nullable Class<?> clazz, IndexCoordinates index)
SearchOperationsquery - the query to executeclazz - the entity clazz used for property mappingindex - the index to run the query againstpublic <T> SearchHits<T> search(Query query, Class<T> clazz, IndexCoordinates index)
SearchOperationsSearchHitsT - element return typequery - the query to executeclazz - the entity clazz used for property mappingindex - the index to run the query againstpublic <T> SearchScrollHits<T> searchScrollStart(long scrollTimeInMillis, Query query, Class<T> clazz, IndexCoordinates index)
searchScrollStart in class AbstractElasticsearchTemplatepublic <T> SearchScrollHits<T> searchScrollContinue(@Nullable String scrollId, long scrollTimeInMillis, Class<T> clazz, IndexCoordinates index)
searchScrollContinue in class AbstractElasticsearchTemplatepublic void searchScrollClear(List<String> scrollIds)
searchScrollClear in class AbstractElasticsearchTemplatepublic org.elasticsearch.action.search.SearchResponse suggest(org.elasticsearch.search.suggest.SuggestBuilder suggestion,
IndexCoordinates index)
SearchOperationssuggestion - the queryindex - the index to run the query againstprotected org.elasticsearch.action.search.MultiSearchResponse.Item[] getMultiSearchResult(org.elasticsearch.action.search.MultiSearchRequest request)
getMultiSearchResult in class AbstractElasticsearchTemplatepublic <T> T execute(ElasticsearchRestTemplate.ClientCallback<T> callback)
RestHighLevelClientT - the type returned from the callbackcallback - the callback to execute, must not be nullprotected String getClusterVersion()
AbstractElasticsearchTemplategetClusterVersion in class AbstractElasticsearchTemplateCopyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.