public class ReactiveElasticsearchTemplate extends AbstractReactiveElasticsearchTemplate
ReactiveElasticsearchOperations
using the new
Elasticsearch client.AbstractReactiveElasticsearchTemplate.DocumentCallback<T>, AbstractReactiveElasticsearchTemplate.Entities<T>, AbstractReactiveElasticsearchTemplate.IndexResponseMetaData, AbstractReactiveElasticsearchTemplate.ReadDocumentCallback<T>, AbstractReactiveElasticsearchTemplate.ReadSearchDocumentCallback<T>, AbstractReactiveElasticsearchTemplate.SearchDocumentCallback<T>
ReactiveElasticsearchOperations.ClusterClientCallback<T extends org.reactivestreams.Publisher<?>>, ReactiveElasticsearchOperations.IndicesClientCallback<T extends org.reactivestreams.Publisher<?>>
converter, entityCallbacks, entityOperations, mappingContext, QUERY_LOGGER, refreshPolicy, routingResolver
Modifier | Constructor and Description |
---|---|
protected |
ReactiveElasticsearchTemplate(ReactiveElasticsearchClient client,
ElasticsearchConverter converter) |
Modifier and Type | Method and Description |
---|---|
reactor.core.publisher.Flux<? extends 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.
|
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 ReactiveElasticsearchTemplate |
doCopy() |
protected reactor.core.publisher.Mono<Long> |
doCount(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(String id,
IndexCoordinates index) |
protected reactor.core.publisher.Flux<SearchDocument> |
doFind(Query query,
Class<?> clazz,
IndexCoordinates index) |
protected <T> reactor.core.publisher.Mono<SearchDocumentResponse> |
doFindForResponse(Query query,
Class<?> clazz,
IndexCoordinates index) |
protected <T> reactor.core.publisher.Mono<reactor.util.function.Tuple2<T,AbstractReactiveElasticsearchTemplate.IndexResponseMetaData>> |
doIndex(T entity,
IndexCoordinates index) |
<T> org.reactivestreams.Publisher<T> |
execute(ReactiveElasticsearchOperations.ClientCallback<org.reactivestreams.Publisher<T>> callback)
Deprecated.
|
<T> org.reactivestreams.Publisher<T> |
execute(org.springframework.data.elasticsearch.client.elc.ReactiveElasticsearchTemplate.ClientCallback<org.reactivestreams.Publisher<T>> callback)
Execute a callback with the
ReactiveElasticsearchClient and provide exception translation. |
<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 reactor.core.publisher.Mono<String> |
getClusterVersion() |
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.
|
reactor.core.publisher.Mono<ReindexResponse> |
reindex(ReindexRequest reindexRequest)
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.
|
reactor.core.publisher.Mono<String> |
submitReindex(ReindexRequest reindexRequest)
Submits a reindex task.
|
reactor.core.publisher.Flux<org.elasticsearch.search.suggest.Suggest> |
suggest(org.elasticsearch.search.suggest.SuggestBuilder suggestion,
Class<?> entityType)
Does a suggest query
|
reactor.core.publisher.Flux<org.elasticsearch.search.suggest.Suggest> |
suggest(org.elasticsearch.search.suggest.SuggestBuilder suggestion,
IndexCoordinates index)
Does a suggest query
|
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, searchForPage, searchForPage, setApplicationContext, setEntityCallbacks, setRefreshPolicy, suggest, suggest, updateIndexedObject, withRouting
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
bulkUpdate, save, save, saveAll, saveAll
count, search, search, searchForHits, searchForHits, searchForPage, searchForPage
protected ReactiveElasticsearchTemplate(ReactiveElasticsearchClient client, ElasticsearchConverter converter)
protected <T> reactor.core.publisher.Mono<reactor.util.function.Tuple2<T,AbstractReactiveElasticsearchTemplate.IndexResponseMetaData>> doIndex(T entity, IndexCoordinates index)
doIndex
in class AbstractReactiveElasticsearchTemplate
public <T> reactor.core.publisher.Flux<T> saveAll(reactor.core.publisher.Mono<? extends Collection<? extends T>> entitiesPublisher, IndexCoordinates index)
ReactiveDocumentOperations
entitiesPublisher
- must not be null.index
- the target index, must not be nullFlux
emitting saved entities.public <T> reactor.core.publisher.Mono<T> get(String id, Class<T> entityType, IndexCoordinates index)
ReactiveDocumentOperations
id
- must not be null.index
- the target index, must not be nullMono
emitting the entity or signalling completion if none found.public reactor.core.publisher.Mono<ReindexResponse> reindex(ReindexRequest reindexRequest)
ReactiveDocumentOperations
reindexRequest
- reindex request parametersMono
emitting the reindex responsepublic reactor.core.publisher.Mono<String> submitReindex(ReindexRequest reindexRequest)
ReactiveDocumentOperations
reindexRequest
- reindex request parametersMono
emitting the task id.public reactor.core.publisher.Mono<Void> bulkUpdate(List<UpdateQuery> queries, BulkOptions bulkOptions, IndexCoordinates index)
ReactiveDocumentOperations
queries
- the queries to execute in bulkbulkOptions
- options to be added to the bulk requestprotected reactor.core.publisher.Mono<String> doDeleteById(String id, @Nullable String routing, IndexCoordinates index)
doDeleteById
in class AbstractReactiveElasticsearchTemplate
public <T> reactor.core.publisher.Flux<MultiGetItem<T>> multiGet(Query query, Class<T> clazz, IndexCoordinates index)
ReactiveDocumentOperations
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.MultiGetItem
s that contain the entitiesQuery.multiGetQuery(Collection)
,
Query.multiGetQueryWithRouting(List)
protected ReactiveElasticsearchTemplate doCopy()
doCopy
in class AbstractReactiveElasticsearchTemplate
protected reactor.core.publisher.Mono<Boolean> doExists(String id, IndexCoordinates index)
doExists
in class AbstractReactiveElasticsearchTemplate
public reactor.core.publisher.Mono<ByQueryResponse> delete(Query query, Class<?> entityType, IndexCoordinates index)
ReactiveDocumentOperations
Query
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.protected reactor.core.publisher.Flux<SearchDocument> doFind(Query query, Class<?> clazz, IndexCoordinates index)
doFind
in class AbstractReactiveElasticsearchTemplate
protected reactor.core.publisher.Mono<Long> doCount(Query query, Class<?> entityType, IndexCoordinates index)
doCount
in class AbstractReactiveElasticsearchTemplate
protected <T> reactor.core.publisher.Mono<SearchDocumentResponse> doFindForResponse(Query query, Class<?> clazz, IndexCoordinates index)
doFindForResponse
in class AbstractReactiveElasticsearchTemplate
public reactor.core.publisher.Flux<? extends AggregationContainer<?>> aggregate(Query query, Class<?> entityType, IndexCoordinates index)
ReactiveSearchOperations
query
. 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.Mono<String> getVendor()
getVendor
in class AbstractReactiveElasticsearchTemplate
protected reactor.core.publisher.Mono<String> getRuntimeLibraryVersion()
getRuntimeLibraryVersion
in class AbstractReactiveElasticsearchTemplate
protected reactor.core.publisher.Mono<String> getClusterVersion()
getClusterVersion
in class AbstractReactiveElasticsearchTemplate
public reactor.core.publisher.Mono<UpdateResponse> update(UpdateQuery updateQuery, IndexCoordinates index)
ReactiveDocumentOperations
updateQuery
- 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)
ReactiveDocumentOperations
updateQuery
- query defining the update, must not be nullindex
- the index where to update the records, must not be nullMono
emitting the update response@Deprecated public <T> org.reactivestreams.Publisher<T> execute(ReactiveElasticsearchOperations.ClientCallback<org.reactivestreams.Publisher<T>> callback)
ReactiveElasticsearchOperations
ReactiveElasticsearchOperations.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)
ReactiveElasticsearchOperations
ReactiveElasticsearchOperations.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)
ReactiveElasticsearchOperations
ReactiveElasticsearchOperations.ClusterClientCallback
managing resources and translating errors.T
- the type the Publisher emitscallback
- must not be null.Publisher
emitting results.public ReactiveIndexOperations indexOps(IndexCoordinates index)
ReactiveElasticsearchOperations
ReactiveIndexOperations
that is bound to the given indexindex
- IndexCoordinates specifying the indexpublic ReactiveIndexOperations indexOps(Class<?> clazz)
ReactiveElasticsearchOperations
ReactiveIndexOperations
that is bound to the given classclazz
- the entity clazz specifiying the index informationpublic ReactiveClusterOperations cluster()
ReactiveElasticsearchOperations
ReactiveClusterOperations
instance that uses the same client communication setup as this
ElasticsearchOperations instance.public reactor.core.publisher.Flux<org.elasticsearch.search.suggest.Suggest> suggest(org.elasticsearch.search.suggest.SuggestBuilder suggestion, Class<?> entityType)
ReactiveSearchOperations
suggestion
- the queryentityType
- must not be null.public reactor.core.publisher.Flux<org.elasticsearch.search.suggest.Suggest> suggest(org.elasticsearch.search.suggest.SuggestBuilder suggestion, IndexCoordinates index)
ReactiveSearchOperations
suggestion
- the queryindex
- the index to run the query againstpublic Query matchAllQuery()
ReactiveSearchOperations
Query
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)
ReactiveSearchOperations
Query
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(org.springframework.data.elasticsearch.client.elc.ReactiveElasticsearchTemplate.ClientCallback<org.reactivestreams.Publisher<T>> callback)
ReactiveElasticsearchClient
and provide exception translation.T
- the type returned from the callbackcallback
- the callback to execute, must not be nullCopyright © 2011–2022 Pivotal Software, Inc.. All rights reserved.