public class ReactiveElasticsearchTemplate extends Object implements ReactiveElasticsearchOperations
ReactiveElasticsearchOperations.ClientCallback<T extends org.reactivestreams.Publisher<?>>| Constructor and Description |
|---|
ReactiveElasticsearchTemplate(ReactiveElasticsearchClient client) |
ReactiveElasticsearchTemplate(ReactiveElasticsearchClient client,
ElasticsearchConverter converter) |
ReactiveElasticsearchTemplate(ReactiveElasticsearchClient client,
ElasticsearchConverter converter,
ResultsMapper resultsMapper) |
| Modifier and Type | Method and Description |
|---|---|
reactor.core.publisher.Mono<Long> |
count(Query query,
Class<?> entityType,
String index,
String type)
Count the number of documents matching the given
Query. |
reactor.core.publisher.Mono<String> |
delete(Object entity,
String index,
String type)
Delete the given entity extracting index and type from entity metadata.
|
reactor.core.publisher.Mono<Long> |
deleteBy(Query query,
Class<?> entityType,
String index,
String type)
Delete the documents matching the given
Query extracting index and type from entity metadata. |
reactor.core.publisher.Mono<String> |
deleteById(String id,
Class<?> entityType,
String index,
String type)
Delete the entity with given id extracting index and type from entity metadata.
|
protected reactor.core.publisher.Mono<Long> |
doCount(org.elasticsearch.client.core.CountRequest 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<Boolean> |
doExists(org.elasticsearch.action.get.GetRequest request)
Customization hook on the actual execution result
Publisher. |
protected reactor.core.publisher.Flux<org.elasticsearch.search.SearchHit> |
doFind(org.elasticsearch.action.search.SearchRequest request)
Customization hook on the actual execution result
Publisher. |
protected reactor.core.publisher.Mono<org.elasticsearch.index.get.GetResult> |
doFindById(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 reactor.core.publisher.Flux<org.elasticsearch.search.SearchHit> |
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. |
reactor.core.publisher.Mono<Boolean> |
exists(String id,
Class<?> entityType,
String index,
String type)
Check if an entity with given id exists.
|
<T> reactor.core.publisher.Flux<T> |
find(Query query,
Class<?> entityType,
String index,
String type,
Class<T> resultType)
Search the index for entities matching the given
query. |
<T> reactor.core.publisher.Mono<T> |
findById(String id,
Class<T> entityType,
String index,
String type)
Fetch the entity with given id.
|
protected ReactiveElasticsearchClient |
getClient()
Obtain the
ReactiveElasticsearchClient to operate upon. |
ElasticsearchConverter |
getElasticsearchConverter()
Get the
ElasticsearchConverter used. |
protected org.elasticsearch.client.core.CountRequest |
prepareCountRequest(org.elasticsearch.client.core.CountRequest request)
Customization hook to modify a generated
SearchRequest prior to its execution. |
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(Object source,
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)
Customization hook to modify a generated
SearchRequest prior to its execution. |
protected <R extends org.elasticsearch.action.support.WriteRequest<R>> |
prepareWriteRequest(R request)
Pre process the write request before it is sent to the server, eg. by setting the
refresh policy if applicable. |
<T> reactor.core.publisher.Mono<T> |
save(T entity,
String index,
String type)
Index the entity under the given type in the given index.
|
void |
setIndicesOptions(org.elasticsearch.action.support.IndicesOptions indicesOptions)
Set the default
IndicesOptions for search requests. |
void |
setRefreshPolicy(org.elasticsearch.action.support.WriteRequest.RefreshPolicy refreshPolicy)
Set the default
WriteRequest.RefreshPolicy to apply when writing to Elasticsearch. |
public ReactiveElasticsearchTemplate(ReactiveElasticsearchClient client)
public ReactiveElasticsearchTemplate(ReactiveElasticsearchClient client, ElasticsearchConverter converter)
public ReactiveElasticsearchTemplate(ReactiveElasticsearchClient client, ElasticsearchConverter converter, ResultsMapper resultsMapper)
public <T> org.reactivestreams.Publisher<T> execute(ReactiveElasticsearchOperations.ClientCallback<org.reactivestreams.Publisher<T>> callback)
ReactiveElasticsearchOperationsReactiveElasticsearchOperations.ClientCallback managing resources and translating errors.execute in interface ReactiveElasticsearchOperationscallback - must not be null.Publisher emitting results.public <T> reactor.core.publisher.Mono<T> save(T entity,
@Nullable
String index,
@Nullable
String type)
ReactiveElasticsearchOperationssave in interface ReactiveElasticsearchOperationsentity - must not be null.index - the name of the target index. Can be null.type - the name of the type within the index. Can be null.Mono emitting the saved entity.public <T> reactor.core.publisher.Mono<T> findById(String id, Class<T> entityType, @Nullable String index, @Nullable String type)
ReactiveElasticsearchOperationsfindById in interface ReactiveElasticsearchOperationsid - must not be null.index - the name of the target index. Overwrites document metadata from entityType if not
null.type - the name of the target type. Overwrites document metadata from entityType if not
null.Mono emitting the entity or signalling completion if none found.public reactor.core.publisher.Mono<Boolean> exists(String id, Class<?> entityType, String index, String type)
ReactiveElasticsearchOperationsexists in interface ReactiveElasticsearchOperationsid - the _id of the document to look for.index - the name of the target index. Overwrites document metadata from entityType if not
null.type - the name of the target type. Overwrites document metadata from entityType if not
null.Mono emitting true if a matching document exists, false otherwise.public <T> reactor.core.publisher.Flux<T> find(Query query, Class<?> entityType, @Nullable String index, @Nullable String type, Class<T> resultType)
ReactiveElasticsearchOperationsquery.find in interface ReactiveElasticsearchOperationsquery - must not be null.entityType - must not be null.index - the name of the target index. Overwrites document metadata from entityType if not
null.type - the name of the target type. Overwrites document metadata from entityType if not
null.resultType - the projection result type.Flux emitting matching entities one by one.public reactor.core.publisher.Mono<Long> count(Query query, Class<?> entityType, String index, String type)
ReactiveElasticsearchOperationsQuery.count in interface ReactiveElasticsearchOperationsquery - must not be null.entityType - must not be null.index - the name of the target index. Overwrites document metadata from entityType if not
null.type - the name of the target type. Overwrites document metadata from entityType if not
null.Mono emitting the nr of matching documents.public reactor.core.publisher.Mono<String> delete(Object entity, @Nullable String index, @Nullable String type)
ReactiveElasticsearchOperationsdelete in interface ReactiveElasticsearchOperationsentity - must not be null.index - the name of the target index. Overwrites document metadata from entityType if not
null.type - the name of the target type. Overwrites document metadata from entityType if not
null.Mono emitting the id of the removed document.public reactor.core.publisher.Mono<String> deleteById(String id, Class<?> entityType, @Nullable String index, @Nullable String type)
ReactiveElasticsearchOperationsdeleteById in interface ReactiveElasticsearchOperationsid - must not be null.entityType - must not be null.index - the name of the target index. Overwrites document metadata from entityType if not
null.type - the name of the target type. Overwrites document metadata from entityType if not
null.Mono emitting the id of the removed document.public reactor.core.publisher.Mono<Long> deleteBy(Query query, Class<?> entityType, String index, String type)
ReactiveElasticsearchOperationsQuery extracting index and type from entity metadata.deleteBy in interface ReactiveElasticsearchOperationsquery - must not be null.entityType - must not be null.index - the name of the target index. Overwrites document metadata from entityType if not
null.type - the name of the target type. Overwrites document metadata from entityType if not
null.Mono emitting the number of the removed documents.public void setRefreshPolicy(@Nullable org.elasticsearch.action.support.WriteRequest.RefreshPolicy refreshPolicy)
WriteRequest.RefreshPolicy to apply when writing to Elasticsearch.refreshPolicy - can be null.public void setIndicesOptions(@Nullable org.elasticsearch.action.support.IndicesOptions indicesOptions)
IndicesOptions for search requests.indicesOptions - can be null.public ElasticsearchConverter getElasticsearchConverter()
ReactiveElasticsearchOperationsElasticsearchConverter used.getElasticsearchConverter in interface ReactiveElasticsearchOperationsprotected ReactiveElasticsearchClient getClient()
ReactiveElasticsearchClient to operate upon.protected <R extends org.elasticsearch.action.support.WriteRequest<R>> R prepareWriteRequest(R request)
refresh policy if applicable.R - request - must not be null.WriteRequest.protected org.elasticsearch.action.index.IndexRequest prepareIndexRequest(Object source, org.elasticsearch.action.index.IndexRequest request)
IndexRequest prior to its execution. Eg. by setting the
refresh policy if applicable.source - the source object the IndexRequest was derived from.request - the generated IndexRequest.protected org.elasticsearch.client.core.CountRequest prepareCountRequest(org.elasticsearch.client.core.CountRequest request)
SearchRequest prior to its execution. Eg. by setting the
indices options if applicable.request - the generated CountRequest.protected org.elasticsearch.action.search.SearchRequest prepareSearchRequest(org.elasticsearch.action.search.SearchRequest request)
SearchRequest prior to its execution. Eg. by setting the
indices options if applicable.request - the generated SearchRequest.protected org.elasticsearch.action.delete.DeleteRequest prepareDeleteRequest(@Nullable Object source, org.elasticsearch.action.delete.DeleteRequest request)
DeleteRequest prior to its execution. Eg. by setting the
refresh policy if applicable.source - the source object the DeleteRequest was derived from. My be null if using the
id directly.request - the generated DeleteRequest.protected org.elasticsearch.index.reindex.DeleteByQueryRequest prepareDeleteByRequest(org.elasticsearch.index.reindex.DeleteByQueryRequest request)
DeleteByQueryRequest prior to its execution. Eg. by setting the
refresh policy if applicable.request - the generated DeleteByQueryRequest.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.protected reactor.core.publisher.Mono<org.elasticsearch.index.get.GetResult> doFindById(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<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 reactor.core.publisher.Flux<org.elasticsearch.search.SearchHit> doFind(org.elasticsearch.action.search.SearchRequest request)
Publisher. request - the already prepared SearchRequest ready to be executed.Flux emitting the result of the operation.protected reactor.core.publisher.Mono<Long> doCount(org.elasticsearch.client.core.CountRequest request)
Publisher. request - the already prepared CountRequest ready to be executed.Mono emitting the result of the operation.protected reactor.core.publisher.Flux<org.elasticsearch.search.SearchHit> doScroll(org.elasticsearch.action.search.SearchRequest request)
Publisher. request - the already prepared SearchRequest ready to be executed.Flux emitting the result of the operation.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.Copyright © 2011–2020 Pivotal Software, Inc.. All rights reserved.