public class ReactiveElasticsearchTemplate extends AbstractReactiveElasticsearchTemplate
AbstractReactiveElasticsearchTemplate.DocumentCallback<T>, AbstractReactiveElasticsearchTemplate.Entities<T>, AbstractReactiveElasticsearchTemplate.IndexResponseMetaData, AbstractReactiveElasticsearchTemplate.ReadDocumentCallback<T>, AbstractReactiveElasticsearchTemplate.ReadSearchDocumentCallback<T>, 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 org.springframework.data.elasticsearch.core.RequestFactory |
requestFactory |
converter, entityCallbacks, entityOperations, mappingContext, QUERY_LOGGER, refreshPolicy, routingResolver| Constructor and Description |
|---|
ReactiveElasticsearchTemplate(ReactiveElasticsearchClient client) |
ReactiveElasticsearchTemplate(ReactiveElasticsearchClient client,
ElasticsearchConverter converter) |
| Modifier and Type | Method and Description |
|---|---|
reactor.core.publisher.Flux<AggregationContainer<?>> |
aggregate(Query query,
Class<?> entityType,
IndexCoordinates index)
Perform an aggregation specified by the given
query. |
reactor.core.publisher.Mono<Void> |
bulkUpdate(List<UpdateQuery> queries,
BulkOptions bulkOptions,
IndexCoordinates index)
Bulk update all objects.
|
protected reactor.core.publisher.Mono<org.elasticsearch.action.bulk.BulkResponse> |
checkForBulkOperationFailure(org.elasticsearch.action.bulk.BulkResponse bulkResponse) |
ReactiveClusterOperations |
cluster()
return a
ReactiveClusterOperations instance that uses the same client communication setup as this
ElasticsearchOperations instance. |
reactor.core.publisher.Mono<ByQueryResponse> |
delete(Query query,
Class<?> entityType,
IndexCoordinates index)
Delete the documents matching the given
Query extracting index from entity metadata. |
protected reactor.core.publisher.Flux<AggregationContainer<?>> |
doAggregate(org.elasticsearch.action.search.SearchRequest request)
Customization hook on the actual execution result
Publisher. |
protected reactor.core.publisher.Flux<org.elasticsearch.action.bulk.BulkItemResponse> |
doBulkOperation(List<?> queries,
BulkOptions bulkOptions,
IndexCoordinates index) |
protected ReactiveElasticsearchTemplate |
doCopy() |
protected reactor.core.publisher.Mono<Long> |
doCount(Query query,
Class<?> entityType,
IndexCoordinates index) |
protected reactor.core.publisher.Mono<Long> |
doCount(org.elasticsearch.action.search.SearchRequest request)
Customization hook on the actual execution result
Publisher. |
protected reactor.core.publisher.Mono<String> |
doDelete(org.elasticsearch.action.delete.DeleteRequest request)
Customization hook on the actual execution result
Publisher. |
protected reactor.core.publisher.Mono<org.elasticsearch.index.reindex.BulkByScrollResponse> |
doDeleteBy(org.elasticsearch.index.reindex.DeleteByQueryRequest request)
Customization hook on the actual execution result
Publisher. |
protected reactor.core.publisher.Mono<org.elasticsearch.index.reindex.BulkByScrollResponse> |
doDeleteBy(Query query,
Class<?> entityType,
IndexCoordinates index) |
protected reactor.core.publisher.Mono<String> |
doDeleteById(String id,
String routing,
IndexCoordinates index) |
protected reactor.core.publisher.Mono<Boolean> |
doExists(org.elasticsearch.action.get.GetRequest request)
Customization hook on the actual execution result
Publisher. |
protected reactor.core.publisher.Mono<Boolean> |
doExists(String id,
IndexCoordinates index) |
protected reactor.core.publisher.Flux<SearchDocument> |
doFind(Query query,
Class<?> clazz,
IndexCoordinates index) |
protected reactor.core.publisher.Flux<SearchDocument> |
doFind(org.elasticsearch.action.search.SearchRequest request)
Customization hook on the actual execution result
Publisher. |
protected <T> reactor.core.publisher.Mono<SearchDocumentResponse> |
doFindForResponse(Query query,
Class<?> clazz,
IndexCoordinates index) |
protected <T> reactor.core.publisher.Mono<SearchDocumentResponse> |
doFindForResponse(org.elasticsearch.action.search.SearchRequest request,
SearchDocumentResponse.EntityCreator<T> entityCreator)
Customization hook on the actual execution result
Mono. |
protected reactor.core.publisher.Mono<org.elasticsearch.index.get.GetResult> |
doGet(org.elasticsearch.action.get.GetRequest request)
Customization hook on the actual execution result
Publisher. |
protected reactor.core.publisher.Mono<org.elasticsearch.action.index.IndexResponse> |
doIndex(org.elasticsearch.action.index.IndexRequest request)
Customization hook on the actual execution result
Publisher. |
protected <T> reactor.core.publisher.Mono<reactor.util.function.Tuple2<T,AbstractReactiveElasticsearchTemplate.IndexResponseMetaData>> |
doIndex(T entity,
IndexCoordinates index) |
protected reactor.core.publisher.Flux<SearchDocument> |
doScroll(org.elasticsearch.action.search.SearchRequest request)
Customization hook on the actual execution result
Publisher. |
<T> org.reactivestreams.Publisher<T> |
execute(ReactiveElasticsearchOperations.ClientCallback<org.reactivestreams.Publisher<T>> callback)
Execute within a
ReactiveElasticsearchOperations.ClientCallback managing resources and translating errors. |
<T> org.reactivestreams.Publisher<T> |
executeWithClusterClient(ReactiveElasticsearchOperations.ClusterClientCallback<org.reactivestreams.Publisher<T>> callback)
Execute within a
ReactiveElasticsearchOperations.ClusterClientCallback managing resources and translating errors. |
<T> org.reactivestreams.Publisher<T> |
executeWithIndicesClient(ReactiveElasticsearchOperations.IndicesClientCallback<org.reactivestreams.Publisher<T>> callback)
Execute within a
ReactiveElasticsearchOperations.IndicesClientCallback managing resources and translating errors. |
<T> reactor.core.publisher.Mono<T> |
get(String id,
Class<T> entityType,
IndexCoordinates index)
Fetch the entity with given id.
|
protected ReactiveElasticsearchClient |
getClient()
Obtain the
ReactiveElasticsearchClient to operate upon. |
protected ReactiveElasticsearchClient.Cluster |
getClusterClient()
Obtain the
ReactiveElasticsearchClient.Cluster to operate upon. |
protected reactor.core.publisher.Mono<String> |
getClusterVersion() |
protected ReactiveElasticsearchClient.Indices |
getIndicesClient()
Obtain the
ReactiveElasticsearchClient.Indices to operate upon. |
protected reactor.core.publisher.Mono<String> |
getRuntimeLibraryVersion() |
protected reactor.core.publisher.Mono<String> |
getVendor() |
Query |
idsQuery(List<String> ids)
Creates a
Query to find get all documents with given ids. |
ReactiveIndexOperations |
indexOps(Class<?> clazz)
Creates a
ReactiveIndexOperations that is bound to the given class |
ReactiveIndexOperations |
indexOps(IndexCoordinates index)
Creates a
ReactiveIndexOperations that is bound to the given index |
Query |
matchAllQuery()
Creates a
Query to find all documents. |
<T> reactor.core.publisher.Flux<MultiGetItem<T>> |
multiGet(Query query,
Class<T> clazz,
IndexCoordinates index)
Execute a multiGet against elasticsearch for the given ids.
|
protected org.elasticsearch.index.reindex.DeleteByQueryRequest |
prepareDeleteByRequest(org.elasticsearch.index.reindex.DeleteByQueryRequest request)
Customization hook to modify a generated
DeleteByQueryRequest prior to its execution. |
protected org.elasticsearch.action.delete.DeleteRequest |
prepareDeleteRequest(org.elasticsearch.action.delete.DeleteRequest request)
Customization hook to modify a generated
DeleteRequest prior to its execution. |
protected org.elasticsearch.action.index.IndexRequest |
prepareIndexRequest(Object source,
org.elasticsearch.action.index.IndexRequest request)
Customization hook to modify a generated
IndexRequest prior to its execution. |
protected org.elasticsearch.action.search.SearchRequest |
prepareSearchRequest(org.elasticsearch.action.search.SearchRequest request,
boolean useScroll)
Customization hook to modify a generated
SearchRequest prior to its execution. |
protected <R extends org.elasticsearch.action.support.WriteRequest<R>> |
prepareWriteRequest(R request)
Preprocess the write request before it is sent to the server, e.g. by setting the
refresh policy if applicable. |
reactor.core.publisher.Mono<ReindexResponse> |
reindex(ReindexRequest postReindexRequest)
Copies documents from a source to a destination.
|
<T> reactor.core.publisher.Flux<T> |
saveAll(reactor.core.publisher.Mono<? extends Collection<? extends T>> entitiesPublisher,
IndexCoordinates index)
Index entities in the given index.
|
<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 |
setIndicesOptions(org.elasticsearch.action.support.IndicesOptions indicesOptions)
Set the default
IndicesOptions for search requests. |
reactor.core.publisher.Mono<String> |
submitReindex(ReindexRequest postReindexRequest)
Submits a reindex task.
|
reactor.core.publisher.Flux<org.elasticsearch.search.suggest.Suggest> |
suggest(org.elasticsearch.search.suggest.SuggestBuilder suggestion,
Class<?> entityType)
Deprecated.
|
reactor.core.publisher.Flux<org.elasticsearch.search.suggest.Suggest> |
suggest(org.elasticsearch.search.suggest.SuggestBuilder suggestion,
IndexCoordinates index)
Deprecated.
|
reactor.core.publisher.Mono<UpdateResponse> |
update(UpdateQuery updateQuery,
IndexCoordinates index)
Partial update of the document.
|
reactor.core.publisher.Mono<ByQueryResponse> |
updateByQuery(UpdateQuery updateQuery,
IndexCoordinates index)
Update document(s) by query.
|
aggregate, count, count, delete, delete, delete, delete, delete, exists, exists, get, getElasticsearchConverter, getIndexCoordinatesFor, getIndexQuery, getPersistentEntityFor, getRefreshPolicy, logVersions, maybeCallAfterConvert, maybeCallAfterSave, maybeCallbackAfterLoad, maybeCallBeforeConvert, multiGet, save, save, saveAll, search, search, searchForHits, searchForHits, setApplicationContext, setEntityCallbacks, setRefreshPolicy, suggest, suggest, updateIndexedObject, withRoutingclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbulkUpdate, save, save, saveAll, saveAllcount, search, search, searchForHits, searchForHits, searchForPage, searchForPageprotected org.springframework.data.elasticsearch.core.RequestFactory requestFactory
public ReactiveElasticsearchTemplate(ReactiveElasticsearchClient client)
public ReactiveElasticsearchTemplate(ReactiveElasticsearchClient client, @Nullable ElasticsearchConverter converter)
protected ReactiveElasticsearchTemplate doCopy()
doCopy in class AbstractReactiveElasticsearchTemplatepublic void setIndicesOptions(@Nullable org.elasticsearch.action.support.IndicesOptions indicesOptions)
IndicesOptions for search requests.indicesOptions - can be null.public <T> reactor.core.publisher.Flux<T> saveAll(reactor.core.publisher.Mono<? extends Collection<? extends T>> entitiesPublisher, IndexCoordinates index)
ReactiveDocumentOperationsentitiesPublisher - must not be null.index - the target index, must not be nullFlux emitting saved entities.public <T> reactor.core.publisher.Flux<MultiGetItem<T>> multiGet(Query query, Class<T> clazz, IndexCoordinates index)
ReactiveDocumentOperationsquery - 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.MultiGetItems that contain the entitiesQuery.multiGetQuery(Collection),
Query.multiGetQueryWithRouting(List)protected reactor.core.publisher.Mono<org.elasticsearch.action.index.IndexResponse> doIndex(org.elasticsearch.action.index.IndexRequest request)
Publisher. request - the already prepared IndexRequest ready to be executed.Mono emitting the result of the operation.public reactor.core.publisher.Mono<Void> bulkUpdate(List<UpdateQuery> queries, BulkOptions bulkOptions, IndexCoordinates index)
ReactiveDocumentOperationsqueries - the queries to execute in bulkbulkOptions - options to be added to the bulk requestprotected reactor.core.publisher.Flux<org.elasticsearch.action.bulk.BulkItemResponse> doBulkOperation(List<?> queries, BulkOptions bulkOptions, IndexCoordinates index)
protected reactor.core.publisher.Mono<org.elasticsearch.action.bulk.BulkResponse> checkForBulkOperationFailure(org.elasticsearch.action.bulk.BulkResponse bulkResponse)
protected reactor.core.publisher.Mono<Boolean> doExists(String id, IndexCoordinates index)
doExists in class AbstractReactiveElasticsearchTemplateprotected reactor.core.publisher.Mono<Boolean> doExists(org.elasticsearch.action.get.GetRequest request)
Publisher. request - the already prepared GetRequest ready to be executed.Mono emitting the result of the operation.protected <T> reactor.core.publisher.Mono<reactor.util.function.Tuple2<T,AbstractReactiveElasticsearchTemplate.IndexResponseMetaData>> doIndex(T entity, IndexCoordinates index)
doIndex in class AbstractReactiveElasticsearchTemplatepublic <T> reactor.core.publisher.Mono<T> get(String id, Class<T> entityType, IndexCoordinates index)
ReactiveDocumentOperationsid - must not be null.index - the target index, must not be nullMono emitting the entity or signalling completion if none found.protected reactor.core.publisher.Mono<org.elasticsearch.index.get.GetResult> doGet(org.elasticsearch.action.get.GetRequest request)
Publisher. request - the already prepared GetRequest ready to be executed.Mono emitting the result of the operation.protected reactor.core.publisher.Mono<String> doDeleteById(String id, @Nullable String routing, IndexCoordinates index)
doDeleteById in class AbstractReactiveElasticsearchTemplatepublic reactor.core.publisher.Mono<ByQueryResponse> delete(Query query, Class<?> entityType, IndexCoordinates index)
ReactiveDocumentOperationsQuery extracting index from entity metadata.query - must not be null.entityType - must not be null.index - the target index, must not be nullMono emitting the number of the removed documents.public reactor.core.publisher.Mono<UpdateResponse> update(UpdateQuery updateQuery, IndexCoordinates index)
ReactiveDocumentOperationsupdateQuery - query defining the updateindex - the index where to update the recordsMono emitting the update responsepublic reactor.core.publisher.Mono<ByQueryResponse> updateByQuery(UpdateQuery updateQuery, IndexCoordinates index)
ReactiveDocumentOperationsupdateQuery - query defining the update, must not be nullindex - the index where to update the records, must not be nullMono emitting the update responsepublic reactor.core.publisher.Mono<ReindexResponse> reindex(ReindexRequest postReindexRequest)
ReactiveDocumentOperationspostReindexRequest - reindex request parametersMono emitting the reindex responsepublic reactor.core.publisher.Mono<String> submitReindex(ReindexRequest postReindexRequest)
ReactiveDocumentOperationspostReindexRequest - reindex request parametersMono emitting the task id.protected reactor.core.publisher.Mono<org.elasticsearch.index.reindex.BulkByScrollResponse> doDeleteBy(Query query, Class<?> entityType, IndexCoordinates index)
protected reactor.core.publisher.Mono<String> doDelete(org.elasticsearch.action.delete.DeleteRequest request)
Publisher. request - the already prepared DeleteRequest ready to be executed.Mono emitting the result of the operation.protected reactor.core.publisher.Mono<org.elasticsearch.index.reindex.BulkByScrollResponse> doDeleteBy(org.elasticsearch.index.reindex.DeleteByQueryRequest request)
Publisher. request - the already prepared DeleteByQueryRequest ready to be executed.Mono emitting the result of the operation.protected org.elasticsearch.action.delete.DeleteRequest prepareDeleteRequest(org.elasticsearch.action.delete.DeleteRequest request)
DeleteRequest prior to its execution. E.g. by setting the
refresh policy if applicable.request - the generated DeleteRequest.protected org.elasticsearch.index.reindex.DeleteByQueryRequest prepareDeleteByRequest(org.elasticsearch.index.reindex.DeleteByQueryRequest request)
DeleteByQueryRequest prior to its execution. E.g. by setting the
refresh policy if applicable.request - the generated DeleteByQueryRequest.protected org.elasticsearch.action.index.IndexRequest prepareIndexRequest(Object source, org.elasticsearch.action.index.IndexRequest request)
IndexRequest prior to its execution. E.g. by setting the
refresh policy if applicable.source - the source object the IndexRequest was derived from.request - the generated IndexRequest.protected <R extends org.elasticsearch.action.support.WriteRequest<R>> R prepareWriteRequest(R request)
refresh policy if applicable.R - request - must not be null.WriteRequest.public <T> reactor.core.publisher.Mono<SearchPage<T>> searchForPage(Query query, Class<?> entityType, Class<T> resultType)
ReactiveSearchOperationsquery.searchForPage in interface ReactiveSearchOperationssearchForPage in class AbstractReactiveElasticsearchTemplatequery - 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 ReactiveSearchOperationssearchForPage in class AbstractReactiveElasticsearchTemplatequery - 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.protected reactor.core.publisher.Flux<SearchDocument> doFind(Query query, Class<?> clazz, IndexCoordinates index)
doFind in class AbstractReactiveElasticsearchTemplateprotected <T> reactor.core.publisher.Mono<SearchDocumentResponse> doFindForResponse(Query query, Class<?> clazz, IndexCoordinates index)
doFindForResponse in class AbstractReactiveElasticsearchTemplatepublic reactor.core.publisher.Flux<AggregationContainer<?>> aggregate(Query query, Class<?> entityType, IndexCoordinates index)
ReactiveSearchOperationsquery. query - must not be null.entityType - must not be null.index - the target index, must not be nullFlux emitting matching aggregations one by one.protected reactor.core.publisher.Flux<AggregationContainer<?>> doAggregate(org.elasticsearch.action.search.SearchRequest request)
Publisher. request - the already prepared SearchRequest ready to be executed.Flux emitting the result of the operation.@Deprecated public reactor.core.publisher.Flux<org.elasticsearch.search.suggest.Suggest> suggest(org.elasticsearch.search.suggest.SuggestBuilder suggestion, Class<?> entityType)
ReactiveSearchOperationssuggestion - the queryentityType - must not be null.@Deprecated public reactor.core.publisher.Flux<org.elasticsearch.search.suggest.Suggest> suggest(org.elasticsearch.search.suggest.SuggestBuilder suggestion, IndexCoordinates index)
ReactiveSearchOperationssuggestion - the queryindex - the index to run the query againstprotected reactor.core.publisher.Mono<Long> doCount(Query query, Class<?> entityType, IndexCoordinates index)
doCount in class AbstractReactiveElasticsearchTemplateprotected reactor.core.publisher.Flux<SearchDocument> doFind(org.elasticsearch.action.search.SearchRequest request)
Publisher. request - the already prepared SearchRequest ready to be executed.Flux emitting the result of the operation converted to SearchDocuments.protected <T> reactor.core.publisher.Mono<SearchDocumentResponse> doFindForResponse(org.elasticsearch.action.search.SearchRequest request, SearchDocumentResponse.EntityCreator<T> entityCreator)
Mono. request - the already prepared SearchRequest ready to be executed.entityCreator - Mono emitting the result of the operation converted to s SearchDocumentResponse.protected reactor.core.publisher.Mono<Long> doCount(org.elasticsearch.action.search.SearchRequest request)
Publisher. request - the already prepared SearchRequest ready to be executed.Mono emitting the result of the operation.protected reactor.core.publisher.Flux<SearchDocument> doScroll(org.elasticsearch.action.search.SearchRequest request)
Publisher. request - the already prepared SearchRequest ready to be executed.Flux emitting the result of the operation converted to SearchDocuments.protected org.elasticsearch.action.search.SearchRequest prepareSearchRequest(org.elasticsearch.action.search.SearchRequest request,
boolean useScroll)
SearchRequest prior to its execution. E.g. by setting the
indices options if applicable.request - the generated SearchRequest.useScroll - protected reactor.core.publisher.Mono<String> getClusterVersion()
getClusterVersion in class AbstractReactiveElasticsearchTemplateprotected reactor.core.publisher.Mono<String> getVendor()
getVendor in class AbstractReactiveElasticsearchTemplateprotected reactor.core.publisher.Mono<String> getRuntimeLibraryVersion()
getRuntimeLibraryVersion in class AbstractReactiveElasticsearchTemplatepublic Query matchAllQuery()
ReactiveSearchOperationsQuery to find all documents. Must be implemented by the concrete implementations to provide an
appropriate query using the respective client.public Query idsQuery(List<String> ids)
ReactiveSearchOperationsQuery to find get all documents with given ids. Must be implemented by the concrete
implementations to provide an appropriate query using the respective client.ids - the list of ids must not be nullpublic <T> org.reactivestreams.Publisher<T> execute(ReactiveElasticsearchOperations.ClientCallback<org.reactivestreams.Publisher<T>> callback)
ReactiveElasticsearchOperationsReactiveElasticsearchOperations.ClientCallback managing resources and translating errors.T - the type the Publisher emitscallback - must not be null.Publisher emitting results.public <T> org.reactivestreams.Publisher<T> executeWithIndicesClient(ReactiveElasticsearchOperations.IndicesClientCallback<org.reactivestreams.Publisher<T>> callback)
ReactiveElasticsearchOperationsReactiveElasticsearchOperations.IndicesClientCallback managing resources and translating errors.T - the type the Publisher emitscallback - must not be null.Publisher emitting results.public <T> org.reactivestreams.Publisher<T> executeWithClusterClient(ReactiveElasticsearchOperations.ClusterClientCallback<org.reactivestreams.Publisher<T>> callback)
ReactiveElasticsearchOperationsReactiveElasticsearchOperations.ClusterClientCallback managing resources and translating errors.T - the type the Publisher emitscallback - must not be null.Publisher emitting results.public ReactiveIndexOperations indexOps(IndexCoordinates index)
ReactiveElasticsearchOperationsReactiveIndexOperations that is bound to the given indexindex - IndexCoordinates specifying the indexpublic ReactiveIndexOperations indexOps(Class<?> clazz)
ReactiveElasticsearchOperationsReactiveIndexOperations that is bound to the given classclazz - the entity clazz specifiying the index informationpublic ReactiveClusterOperations cluster()
ReactiveElasticsearchOperationsReactiveClusterOperations instance that uses the same client communication setup as this
ElasticsearchOperations instance.protected ReactiveElasticsearchClient getClient()
ReactiveElasticsearchClient to operate upon.protected ReactiveElasticsearchClient.Indices getIndicesClient()
ReactiveElasticsearchClient.Indices to operate upon.protected ReactiveElasticsearchClient.Cluster getClusterClient()
ReactiveElasticsearchClient.Cluster to operate upon.Copyright © 2011–2022 Pivotal Software, Inc.. All rights reserved.