public abstract class AbstractReactiveElasticsearchTemplate extends Object implements ReactiveElasticsearchOperations, ApplicationContextAware
ReactiveElasticsearchOperations interface
independent of the used client.| Modifier and Type | Class and Description |
|---|---|
protected static interface |
AbstractReactiveElasticsearchTemplate.DocumentCallback<T> |
protected class |
AbstractReactiveElasticsearchTemplate.Entities<T> |
static class |
AbstractReactiveElasticsearchTemplate.IndexResponseMetaData
Value class to capture client independent information from a response to an index request.
|
protected class |
AbstractReactiveElasticsearchTemplate.ReadDocumentCallback<T> |
protected class |
AbstractReactiveElasticsearchTemplate.ReadSearchDocumentCallback<T> |
protected static interface |
AbstractReactiveElasticsearchTemplate.SearchDocumentCallback<T> |
ReactiveElasticsearchOperations.ClientCallback<T extends org.reactivestreams.Publisher<?>>, ReactiveElasticsearchOperations.ClusterClientCallback<T extends org.reactivestreams.Publisher<?>>, ReactiveElasticsearchOperations.IndicesClientCallback<T extends org.reactivestreams.Publisher<?>>| Modifier and Type | Field and Description |
|---|---|
protected ElasticsearchConverter |
converter |
protected ReactiveEntityCallbacks |
entityCallbacks |
protected EntityOperations |
entityOperations |
protected SimpleElasticsearchMappingContext |
mappingContext |
protected static org.slf4j.Logger |
QUERY_LOGGER |
protected RefreshPolicy |
refreshPolicy |
protected RoutingResolver |
routingResolver |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractReactiveElasticsearchTemplate(ElasticsearchConverter converter) |
| Modifier and Type | Method and Description |
|---|---|
reactor.core.publisher.Flux<? extends AggregationContainer<?>> |
aggregate(Query query,
Class<?> entityType)
Perform an aggregation specified by the given
query. |
reactor.core.publisher.Mono<Long> |
count(Query query,
Class<?> entityType)
Count the number of documents matching the given
Query. |
reactor.core.publisher.Mono<Long> |
count(Query query,
Class<?> entityType,
IndexCoordinates index)
Count the number of documents matching the given
Query. |
reactor.core.publisher.Mono<String> |
delete(Object entity)
Delete the given entity extracting index from entity metadata.
|
reactor.core.publisher.Mono<String> |
delete(Object entity,
IndexCoordinates index)
Delete the given entity extracting index from entity metadata.
|
reactor.core.publisher.Mono<ByQueryResponse> |
delete(Query query,
Class<?> entityType)
Delete the documents matching the given
Query extracting index from entity metadata. |
reactor.core.publisher.Mono<String> |
delete(String id,
Class<?> entityType)
Delete the entity with given id extracting index from entity metadata.
|
reactor.core.publisher.Mono<String> |
delete(String id,
IndexCoordinates index)
Delete the entity with given id.
|
protected abstract AbstractReactiveElasticsearchTemplate |
doCopy() |
protected abstract reactor.core.publisher.Mono<Long> |
doCount(Query query,
Class<?> entityType,
IndexCoordinates index) |
protected abstract reactor.core.publisher.Mono<String> |
doDeleteById(String id,
String routing,
IndexCoordinates index) |
protected abstract reactor.core.publisher.Mono<Boolean> |
doExists(String id,
IndexCoordinates index) |
protected abstract reactor.core.publisher.Flux<SearchDocument> |
doFind(Query query,
Class<?> clazz,
IndexCoordinates index) |
protected abstract <T> reactor.core.publisher.Mono<SearchDocumentResponse> |
doFindForResponse(Query query,
Class<?> clazz,
IndexCoordinates index) |
protected abstract <T> reactor.core.publisher.Mono<reactor.util.function.Tuple2<T,AbstractReactiveElasticsearchTemplate.IndexResponseMetaData>> |
doIndex(T entity,
IndexCoordinates index) |
reactor.core.publisher.Mono<Boolean> |
exists(String id,
Class<?> entityType)
Check if an entity with given id exists.
|
reactor.core.publisher.Mono<Boolean> |
exists(String id,
IndexCoordinates index)
Check if an entity with given id exists.
|
<T> reactor.core.publisher.Mono<T> |
get(String id,
Class<T> entityType)
Find the document with the given id mapped onto the given entityType.
|
protected abstract reactor.core.publisher.Mono<String> |
getClusterVersion() |
ElasticsearchConverter |
getElasticsearchConverter()
Get the
ElasticsearchConverter used. |
IndexCoordinates |
getIndexCoordinatesFor(Class<?> clazz) |
protected IndexQuery |
getIndexQuery(Object value) |
ElasticsearchPersistentEntity<?> |
getPersistentEntityFor(Class<?> type) |
RefreshPolicy |
getRefreshPolicy() |
protected abstract reactor.core.publisher.Mono<String> |
getRuntimeLibraryVersion() |
protected abstract reactor.core.publisher.Mono<String> |
getVendor() |
reactor.core.publisher.Mono<Void> |
logVersions()
logs the versions of the different Elasticsearch components.
|
protected <T> reactor.core.publisher.Mono<T> |
maybeCallAfterConvert(T entity,
Document document,
IndexCoordinates index) |
protected <T> reactor.core.publisher.Mono<T> |
maybeCallAfterSave(T entity,
IndexCoordinates index) |
protected <T> reactor.core.publisher.Mono<Document> |
maybeCallbackAfterLoad(Document document,
Class<T> type,
IndexCoordinates index) |
protected <T> reactor.core.publisher.Mono<T> |
maybeCallBeforeConvert(T entity,
IndexCoordinates index) |
<T> reactor.core.publisher.Flux<MultiGetItem<T>> |
multiGet(Query query,
Class<T> clazz)
Execute a multiGet against elasticsearch for the given ids.
|
<T> reactor.core.publisher.Mono<T> |
save(T entity)
Index the given entity extracting index from entity metadata.
|
<T> reactor.core.publisher.Mono<T> |
save(T entity,
IndexCoordinates index)
Index the entity under the given type in the given index.
|
<T> reactor.core.publisher.Flux<T> |
saveAll(reactor.core.publisher.Mono<? extends Collection<? extends T>> entities,
Class<T> clazz)
Index entities in the index extracted from entity metadata.
|
<T> reactor.core.publisher.Flux<SearchHit<T>> |
search(Query query,
Class<?> entityType,
Class<T> returnType)
Search the index for entities matching the given
query. |
<T> reactor.core.publisher.Flux<SearchHit<T>> |
search(Query query,
Class<?> entityType,
Class<T> resultType,
IndexCoordinates index)
Search the index for entities matching the given
query. |
<T> reactor.core.publisher.Mono<ReactiveSearchHits<T>> |
searchForHits(Query query,
Class<?> entityType,
Class<T> resultType)
Perform a search and return the
ReactiveSearchHits which contains information about the search results and
which will provide the documents by the ReactiveSearchHits.getSearchHits() method. |
<T> reactor.core.publisher.Mono<ReactiveSearchHits<T>> |
searchForHits(Query query,
Class<?> entityType,
Class<T> resultType,
IndexCoordinates index)
Perform a search and return the
ReactiveSearchHits which contains information about the search results and
which will provide the documents by the ReactiveSearchHits.getSearchHits() method. |
<T> reactor.core.publisher.Mono<SearchPage<T>> |
searchForPage(Query query,
Class<?> entityType,
Class<T> resultType)
Search the index for entities matching the given
query. |
<T> reactor.core.publisher.Mono<SearchPage<T>> |
searchForPage(Query query,
Class<?> entityType,
Class<T> resultType,
IndexCoordinates index)
Search the index for entities matching the given
query. |
void |
setApplicationContext(ApplicationContext applicationContext) |
void |
setEntityCallbacks(ReactiveEntityCallbacks entityCallbacks)
Set the
ReactiveEntityCallbacks instance to use when invoking callbacks
like the ReactiveBeforeConvertCallback. |
void |
setRefreshPolicy(RefreshPolicy refreshPolicy)
Set the default
RefreshPolicy to apply when writing to Elasticsearch. |
reactor.core.publisher.Mono<Suggest> |
suggest(Query query,
Class<?> entityType)
Does a suggest query.
|
reactor.core.publisher.Mono<Suggest> |
suggest(Query query,
Class<?> entityType,
IndexCoordinates index)
Does a suggest query.
|
protected <T> T |
updateIndexedObject(T entity,
IndexedObjectInformation indexedObjectInformation) |
ReactiveElasticsearchOperations |
withRouting(RoutingResolver routingResolver)
Returns a copy of this instance with the same configuration, but that uses a different
RoutingResolver to
obtain routing information. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcluster, execute, executeWithClusterClient, executeWithIndicesClient, indexOps, indexOpsbulkUpdate, bulkUpdate, delete, get, multiGet, reindex, save, save, saveAll, saveAll, saveAll, submitReindex, update, updateByQueryaggregate, count, idsQuery, matchAllQuery, search, search, searchForHits, searchForHits, searchForPage, searchForPage, suggest, suggestprotected static final org.slf4j.Logger QUERY_LOGGER
protected final ElasticsearchConverter converter
protected final SimpleElasticsearchMappingContext mappingContext
protected final EntityOperations entityOperations
@Nullable protected RefreshPolicy refreshPolicy
protected RoutingResolver routingResolver
@Nullable protected ReactiveEntityCallbacks entityCallbacks
protected AbstractReactiveElasticsearchTemplate(@Nullable ElasticsearchConverter converter)
public ElasticsearchConverter getElasticsearchConverter()
ReactiveElasticsearchOperationsElasticsearchConverter used.getElasticsearchConverter in interface ReactiveElasticsearchOperationsprotected abstract AbstractReactiveElasticsearchTemplate doCopy()
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
setApplicationContext in interface ApplicationContextAwareBeansExceptionpublic void setRefreshPolicy(@Nullable RefreshPolicy refreshPolicy)
RefreshPolicy to apply when writing to Elasticsearch.refreshPolicy - can be null.@Nullable public RefreshPolicy getRefreshPolicy()
RefreshPolicy.public void setEntityCallbacks(ReactiveEntityCallbacks entityCallbacks)
ReactiveEntityCallbacks instance to use when invoking callbacks
like the ReactiveBeforeConvertCallback. Overrides potentially existing ReactiveEntityCallbacks.entityCallbacks - must not be null.IllegalArgumentException - if the given instance is null.public reactor.core.publisher.Mono<Void> logVersions()
public ReactiveElasticsearchOperations withRouting(RoutingResolver routingResolver)
ReactiveElasticsearchOperationsRoutingResolver to
obtain routing information.withRouting in interface ReactiveElasticsearchOperationsroutingResolver - the RoutingResolver value, must not be null.public <T> reactor.core.publisher.Mono<T> save(T entity)
ReactiveDocumentOperationssave in interface ReactiveDocumentOperationsentity - must not be null.Mono emitting the saved entity.public <T> reactor.core.publisher.Flux<T> saveAll(reactor.core.publisher.Mono<? extends Collection<? extends T>> entities, Class<T> clazz)
ReactiveDocumentOperationssaveAll in interface ReactiveDocumentOperationsentities - must not be null.clazz - the entity class, used to determine the indexFlux emitting saved entities.protected IndexQuery getIndexQuery(Object value)
protected <T> T updateIndexedObject(T entity,
IndexedObjectInformation indexedObjectInformation)
public <T> reactor.core.publisher.Flux<MultiGetItem<T>> multiGet(Query query, Class<T> clazz)
ReactiveDocumentOperationsmultiGet in interface ReactiveDocumentOperationsquery - the query defining the ids of the objects to getclazz - the type of the object to be returned, used to determine the indexMultiGetItems that contain the entitiesQuery.multiGetQuery(Collection),
Query.multiGetQueryWithRouting(List)public reactor.core.publisher.Mono<Boolean> exists(String id, Class<?> entityType)
ReactiveDocumentOperationsexists in interface ReactiveDocumentOperationsid - the _id of the document to look for.entityType - the domain type used.Mono emitting true if a matching document exists, false otherwise.public reactor.core.publisher.Mono<Boolean> exists(String id, IndexCoordinates index)
ReactiveDocumentOperationsexists in interface ReactiveDocumentOperationsid - the _id of the document to look for.index - the target index, must not be nullMono emitting true if a matching document exists, false otherwise.public <T> reactor.core.publisher.Mono<T> save(T entity,
IndexCoordinates index)
ReactiveDocumentOperationssave in interface ReactiveDocumentOperationsentity - must not be null.index - the target index, must not be nullMono emitting the saved entity.protected abstract <T> reactor.core.publisher.Mono<reactor.util.function.Tuple2<T,AbstractReactiveElasticsearchTemplate.IndexResponseMetaData>> doIndex(T entity, IndexCoordinates index)
protected abstract reactor.core.publisher.Mono<Boolean> doExists(String id, IndexCoordinates index)
public <T> reactor.core.publisher.Mono<T> get(String id, Class<T> entityType)
ReactiveDocumentOperationsget in interface ReactiveDocumentOperationsid - the _id of the document to fetch.entityType - the domain type used for mapping the document.Mono.empty() if not found.public reactor.core.publisher.Mono<String> delete(Object entity, IndexCoordinates index)
ReactiveDocumentOperationsdelete in interface ReactiveDocumentOperationsentity - must not be null.index - the target index, must not be nullMono emitting the id of the removed document.public reactor.core.publisher.Mono<String> delete(Object entity)
ReactiveDocumentOperationsdelete in interface ReactiveDocumentOperationsentity - must not be null.Mono emitting the id of the removed document.public reactor.core.publisher.Mono<String> delete(String id, Class<?> entityType)
ReactiveDocumentOperationsdelete in interface ReactiveDocumentOperationsid - must not be null.entityType - must not be null.Mono emitting the id of the removed document.public reactor.core.publisher.Mono<String> delete(String id, IndexCoordinates index)
ReactiveDocumentOperationsdelete in interface ReactiveDocumentOperationsid - must not be null.index - the target index, must not be nullMono emitting the id of the removed document.protected abstract reactor.core.publisher.Mono<String> doDeleteById(String id, @Nullable String routing, IndexCoordinates index)
public reactor.core.publisher.Mono<ByQueryResponse> delete(Query query, Class<?> entityType)
ReactiveDocumentOperationsQuery extracting index from entity metadata.delete in interface ReactiveDocumentOperationsquery - must not be null.entityType - must not be null.Mono emitting the number of the removed documents.public <T> reactor.core.publisher.Flux<SearchHit<T>> search(Query query, Class<?> entityType, Class<T> resultType, IndexCoordinates index)
ReactiveSearchOperationsquery.search in interface ReactiveSearchOperationsquery - must not be null.entityType - must not be null.resultType - the projection result type.index - the target index, must not be nullFlux emitting matching entities one by one wrapped in a SearchHit.public <T> reactor.core.publisher.Flux<SearchHit<T>> search(Query query, Class<?> entityType, Class<T> returnType)
ReactiveSearchOperationsquery. Unpaged queries may overrule elasticsearch server defaults for page size by either *
delegating to the scroll API or using a max *
size.search in interface ReactiveSearchOperationsquery - must not be null.entityType - The entity type for mapping the query. Must not be null.returnType - The mapping target type. Must not be null. ThFlux emitting matching entities one by one wrapped in a SearchHit.public <T> reactor.core.publisher.Mono<SearchPage<T>> searchForPage(Query query, Class<?> entityType, Class<T> resultType)
ReactiveSearchOperationsquery.searchForPage in interface ReactiveSearchOperationsquery - must not be null.entityType - must not be null.resultType - the projection result type.Mono emitting matching entities in a SearchHits.public <T> reactor.core.publisher.Mono<SearchPage<T>> searchForPage(Query query, Class<?> entityType, Class<T> resultType, IndexCoordinates index)
ReactiveSearchOperationsquery.searchForPage in interface ReactiveSearchOperationsquery - must not be null.entityType - must not be null.resultType - the projection result type.index - the target index, must not be nullMono emitting matching entities in a SearchHits.public <T> reactor.core.publisher.Mono<ReactiveSearchHits<T>> searchForHits(Query query, Class<?> entityType, Class<T> resultType)
ReactiveSearchOperationsReactiveSearchHits which contains information about the search results and
which will provide the documents by the ReactiveSearchHits.getSearchHits() method.searchForHits in interface ReactiveSearchOperationsT - the result type classquery - must not be null.entityType - must not be null.resultType - the projection result type.Mono emitting the ReactiveSearchHits that contains the search result informationpublic <T> reactor.core.publisher.Mono<ReactiveSearchHits<T>> searchForHits(Query query, Class<?> entityType, Class<T> resultType, IndexCoordinates index)
ReactiveSearchOperationsReactiveSearchHits which contains information about the search results and
which will provide the documents by the ReactiveSearchHits.getSearchHits() method.searchForHits in interface ReactiveSearchOperationsT - the result type classquery - must not be null.entityType - must not be null.resultType - the projection result type.index - the target index, must not be nullMono emitting the ReactiveSearchHits that contains the search result informationprotected abstract reactor.core.publisher.Flux<SearchDocument> doFind(Query query, Class<?> clazz, IndexCoordinates index)
protected abstract <T> reactor.core.publisher.Mono<SearchDocumentResponse> doFindForResponse(Query query, Class<?> clazz, IndexCoordinates index)
public reactor.core.publisher.Flux<? extends AggregationContainer<?>> aggregate(Query query, Class<?> entityType)
ReactiveSearchOperationsquery. aggregate in interface ReactiveSearchOperationsquery - must not be null.entityType - must not be null.Flux emitting matching aggregations one by one.public reactor.core.publisher.Mono<Suggest> suggest(Query query, Class<?> entityType)
ReactiveSearchOperationssuggest in interface ReactiveSearchOperationsquery - the Query containing the suggest definition. Must be currently a NativeSearchQuery, must not
be null.entityType - the type of the entities that might be returned for a completion suggestion, must not be
null.public reactor.core.publisher.Mono<Suggest> suggest(Query query, Class<?> entityType, IndexCoordinates index)
ReactiveSearchOperationssuggest in interface ReactiveSearchOperationsquery - the Query containing the suggest definition. Must be currently a NativeSearchQuery, must not
be null.entityType - the type of the entities that might be returned for a completion suggestion, must not be
null.index - the index to run the query against, must not be null.public reactor.core.publisher.Mono<Long> count(Query query, Class<?> entityType)
ReactiveSearchOperationsQuery.count in interface ReactiveSearchOperationsquery - must not be null.entityType - must not be null.Mono emitting the nr of matching documents.public reactor.core.publisher.Mono<Long> count(Query query, Class<?> entityType, IndexCoordinates index)
ReactiveSearchOperationsQuery.count in interface ReactiveSearchOperationsquery - must not be null.entityType - must not be null.index - the target index, must not be nullMono emitting the nr of matching documents.protected abstract reactor.core.publisher.Mono<Long> doCount(Query query, Class<?> entityType, IndexCoordinates index)
protected <T> reactor.core.publisher.Mono<T> maybeCallBeforeConvert(T entity,
IndexCoordinates index)
protected <T> reactor.core.publisher.Mono<T> maybeCallAfterSave(T entity,
IndexCoordinates index)
protected <T> reactor.core.publisher.Mono<T> maybeCallAfterConvert(T entity,
Document document,
IndexCoordinates index)
protected <T> reactor.core.publisher.Mono<Document> maybeCallbackAfterLoad(Document document, Class<T> type, IndexCoordinates index)
public IndexCoordinates getIndexCoordinatesFor(Class<?> clazz)
getIndexCoordinatesFor in interface ReactiveElasticsearchOperations@Nullable public ElasticsearchPersistentEntity<?> getPersistentEntityFor(@Nullable Class<?> type)
getPersistentEntityFor in interface ReactiveElasticsearchOperationsprotected abstract reactor.core.publisher.Mono<String> getVendor()
protected abstract reactor.core.publisher.Mono<String> getRuntimeLibraryVersion()
protected abstract reactor.core.publisher.Mono<String> getClusterVersion()
Copyright © 2011–2022 Pivotal Software, Inc.. All rights reserved.