public abstract class AbstractElasticsearchTemplate extends Object implements ElasticsearchOperations, ApplicationContextAware
Modifier and Type | Field and Description |
---|---|
protected ElasticsearchConverter |
elasticsearchConverter |
protected IndexOperations |
indexOperations |
protected org.springframework.data.elasticsearch.core.RequestFactory |
requestFactory |
Constructor and Description |
---|
AbstractElasticsearchTemplate() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkForBulkOperationFailure(org.elasticsearch.action.bulk.BulkResponse bulkResponse) |
protected ElasticsearchConverter |
createElasticsearchConverter() |
void |
delete(Query query,
Class<?> clazz,
IndexCoordinates index)
Delete all records matching the query.
|
ElasticsearchConverter |
getElasticsearchConverter() |
IndexCoordinates |
getIndexCoordinatesFor(Class<?> clazz) |
IndexOperations |
getIndexOperations() |
protected abstract org.elasticsearch.action.search.MultiSearchResponse.Item[] |
getMultiSearchResult(org.elasticsearch.action.search.MultiSearchRequest request) |
org.springframework.data.elasticsearch.core.RequestFactory |
getRequestFactory() |
protected void |
initialize(ElasticsearchConverter elasticsearchConverter,
IndexOperations indexOperations) |
<T> List<SearchHits<T>> |
multiSearch(List<? extends Query> queries,
Class<T> clazz,
IndexCoordinates index)
Execute the multi search query against elasticsearch and return result as
List of SearchHits . |
List<SearchHits<?>> |
multiSearch(List<? extends Query> queries,
List<Class<?>> classes,
IndexCoordinates index)
Execute the multi search query against elasticsearch and return result as
List of SearchHits . |
<T> SearchHits<T> |
search(MoreLikeThisQuery query,
Class<T> clazz,
IndexCoordinates index)
more like this query to search for documents that are "like" a specific document.
|
<T> CloseableIterator<SearchHit<T>> |
searchForStream(Query query,
Class<T> clazz,
IndexCoordinates index)
Executes the given
Query against elasticsearch and return result as CloseableIterator . |
void |
setApplicationContext(ApplicationContext context) |
protected void |
setPersistentEntityId(Object entity,
String id) |
<T> CloseableIterator<T> |
stream(Query query,
Class<T> clazz,
IndexCoordinates index)
Executes the given
Query against elasticsearch and return result as CloseableIterator . |
abstract org.elasticsearch.action.search.SearchResponse |
suggest(org.elasticsearch.search.suggest.SuggestBuilder suggestion,
IndexCoordinates index)
Does a suggest query
|
protected static String[] |
toArray(List<String> values) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addAlias, createIndex, createIndex, createIndex, createIndex, deleteIndex, deleteIndex, getMapping, getMapping, getSetting, getSetting, indexExists, indexExists, putMapping, putMapping, putMapping, putMapping, queryForAlias, refresh, refresh, removeAlias
bulkIndex, bulkIndex, bulkUpdate, bulkUpdate, delete, delete, get, index, multiGet, update
clearScroll, continueScroll, count, count, moreLikeThis, queryForIds, queryForList, queryForList, queryForList, queryForObject, queryForPage, queryForPage, queryForPage, search, searchOne, searchScrollClear, searchScrollContinue, searchScrollStart, startScroll
protected ElasticsearchConverter elasticsearchConverter
protected org.springframework.data.elasticsearch.core.RequestFactory requestFactory
protected IndexOperations indexOperations
protected void initialize(ElasticsearchConverter elasticsearchConverter, IndexOperations indexOperations)
protected ElasticsearchConverter createElasticsearchConverter()
public void setApplicationContext(ApplicationContext context) throws BeansException
setApplicationContext
in interface ApplicationContextAware
BeansException
public IndexOperations getIndexOperations()
getIndexOperations
in interface ElasticsearchOperations
public void delete(Query query, Class<?> clazz, IndexCoordinates index)
DocumentOperations
delete
in interface DocumentOperations
query
- query defining the objectsclazz
- The entity class, must be annotated with
Document
index
- the index from which to deletepublic <T> CloseableIterator<T> stream(Query query, Class<T> clazz, IndexCoordinates index)
SearchOperations
Query
against elasticsearch and return result as CloseableIterator
.
stream
in interface SearchOperations
T
- element return typequery
- the query to executeclazz
- the entity clazz used for property mappingindex
- the index to run the query againstCloseableIterator
that wraps an Elasticsearch scroll context that needs to be closed in case of *
error.public <T> CloseableIterator<SearchHit<T>> searchForStream(Query query, Class<T> clazz, IndexCoordinates index)
SearchOperations
Query
against elasticsearch and return result as CloseableIterator
.
searchForStream
in interface SearchOperations
T
- element return typequery
- the query to executeclazz
- the entity clazz used for property mappingindex
- the index to run the query againstCloseableIterator
that wraps an Elasticsearch scroll context that needs to be closed in case of *
error.public <T> SearchHits<T> search(MoreLikeThisQuery query, Class<T> clazz, IndexCoordinates index)
SearchOperations
search
in interface SearchOperations
T
- element return typequery
- the query to executeclazz
- the entity clazz used for property mappingindex
- the index to run the query againstpublic <T> List<SearchHits<T>> multiSearch(List<? extends Query> queries, Class<T> clazz, IndexCoordinates index)
SearchOperations
List
of SearchHits
.multiSearch
in interface SearchOperations
T
- element return typequeries
- the queries to executeclazz
- the entity clazz used for property mappingindex
- the index to run the query againstpublic List<SearchHits<?>> multiSearch(List<? extends Query> queries, List<Class<?>> classes, IndexCoordinates index)
SearchOperations
List
of SearchHits
.multiSearch
in interface SearchOperations
queries
- the queries to executeclasses
- the entity classes used for property mappingindex
- the index to run the query againstprotected abstract org.elasticsearch.action.search.MultiSearchResponse.Item[] getMultiSearchResult(org.elasticsearch.action.search.MultiSearchRequest request)
public ElasticsearchConverter getElasticsearchConverter()
getElasticsearchConverter
in interface ElasticsearchOperations
public org.springframework.data.elasticsearch.core.RequestFactory getRequestFactory()
public abstract org.elasticsearch.action.search.SearchResponse suggest(org.elasticsearch.search.suggest.SuggestBuilder suggestion, IndexCoordinates index)
SearchOperations
suggest
in interface SearchOperations
suggestion
- the queryindex
- the index to run the query againstpublic IndexCoordinates getIndexCoordinatesFor(Class<?> clazz)
getIndexCoordinatesFor
in interface ElasticsearchOperations
clazz
- the entity classprotected void checkForBulkOperationFailure(org.elasticsearch.action.bulk.BulkResponse bulkResponse)
Copyright © 2011–2020 Pivotal Software, Inc.. All rights reserved.