Interface ReactiveSearchOperations
- All Known Subinterfaces:
ReactiveElasticsearchOperations
- All Known Implementing Classes:
AbstractReactiveElasticsearchTemplate
,ReactiveElasticsearchTemplate
,ReactiveElasticsearchTemplate
public interface ReactiveSearchOperations
The reactive operations for the
Elasticsearch Document
APIs.
- Since:
- 4.0
- Author:
- Peter-Josef Meisch, Russell Parry, Thomas Geese
-
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Flux<? extends AggregationContainer<?>>
Perform an aggregation specified by the givenquery
.reactor.core.publisher.Flux<? extends AggregationContainer<?>>
aggregate
(Query query, Class<?> entityType, IndexCoordinates index) Perform an aggregation specified by the givenquery
.reactor.core.publisher.Mono<Boolean>
closePointInTime
(String pit) Closes a point in timedefault reactor.core.publisher.Mono<Long>
Count the number of documents matching the givenQuery
.reactor.core.publisher.Mono<Long>
Count the number of documents matching the givenQuery
.reactor.core.publisher.Mono<Long>
count
(Query query, Class<?> entityType, IndexCoordinates index) Count the number of documents matching the givenQuery
.Creates aQuery
to find get all documents with given ids.Creates aQuery
to find all documents.default reactor.core.publisher.Mono<String>
openPointInTime
(IndexCoordinates index, Duration keepAlive) Opens a point in time (pit) in Elasticsearch.reactor.core.publisher.Mono<String>
openPointInTime
(IndexCoordinates index, Duration keepAlive, Boolean ignoreUnavailable) Opens a point in time (pit) in Elasticsearch.<T> reactor.core.publisher.Flux<SearchHit<T>>
Search the index for entities matching the givenquery
.<T> reactor.core.publisher.Flux<SearchHit<T>>
search
(Query query, Class<?> entityType, Class<T> resultType, IndexCoordinates index) Search the index for entities matching the givenquery
.default <T> reactor.core.publisher.Flux<SearchHit<T>>
Search the index for entities matching the givenquery
.default <T> reactor.core.publisher.Flux<SearchHit<T>>
search
(Query query, Class<T> entityType, IndexCoordinates index) Search the index for entities matching the givenquery
.<T> reactor.core.publisher.Mono<ReactiveSearchHits<T>>
searchForHits
(Query query, Class<?> entityType, Class<T> resultType) Perform a search and return theReactiveSearchHits
which contains information about the search results and which will provide the documents by theReactiveSearchHits.getSearchHits()
method.<T> reactor.core.publisher.Mono<ReactiveSearchHits<T>>
searchForHits
(Query query, Class<?> entityType, Class<T> resultType, IndexCoordinates index) Perform a search and return theReactiveSearchHits
which contains information about the search results and which will provide the documents by theReactiveSearchHits.getSearchHits()
method.default <T> reactor.core.publisher.Mono<ReactiveSearchHits<T>>
searchForHits
(Query query, Class<T> entityType) Perform a search and return theReactiveSearchHits
which contains information about the search results and which will provide the documents by theReactiveSearchHits.getSearchHits()
method.default <T> reactor.core.publisher.Mono<ReactiveSearchHits<T>>
searchForHits
(Query query, Class<T> entityType, IndexCoordinates index) Perform a search and return theReactiveSearchHits
which contains information about the search results and which will provide the documents by theReactiveSearchHits.getSearchHits()
method.<T> reactor.core.publisher.Mono<SearchPage<T>>
searchForPage
(Query query, Class<?> entityType, Class<T> resultType) Search the index for entities matching the givenquery
.<T> reactor.core.publisher.Mono<SearchPage<T>>
searchForPage
(Query query, Class<?> entityType, Class<T> resultType, IndexCoordinates index) Search the index for entities matching the givenquery
.default <T> reactor.core.publisher.Mono<SearchPage<T>>
searchForPage
(Query query, Class<T> entityType) Search the index for entities matching the givenquery
.default <T> reactor.core.publisher.Mono<SearchPage<T>>
searchForPage
(Query query, Class<T> entityType, IndexCoordinates index) Search the index for entities matching the givenquery
.reactor.core.publisher.Mono<Suggest>
Does a suggest query.reactor.core.publisher.Mono<Suggest>
suggest
(Query query, Class<?> entityType, IndexCoordinates index) Does a suggest query.
-
Method Details
-
count
Count the number of documents matching the givenQuery
.- Parameters:
entityType
- must not be null.- Returns:
- a
Mono
emitting the nr of matching documents.
-
count
Count the number of documents matching the givenQuery
.- Parameters:
query
- must not be null.entityType
- must not be null.- Returns:
- a
Mono
emitting the nr of matching documents.
-
count
Count the number of documents matching the givenQuery
.- Parameters:
query
- must not be null.entityType
- must not be null.index
- the target index, must not be null- Returns:
- a
Mono
emitting the nr of matching documents.
-
search
Search the index for entities matching the givenquery
.
Unpaged
queries may overrule elasticsearch server defaults for page size by either delegating to the scroll API or using a maxsize
.- Type Parameters:
T
-- Parameters:
query
- must not be null.entityType
- must not be null.- Returns:
- a
Flux
emitting matching entities one by one wrapped in aSearchHit
.
-
search
<T> reactor.core.publisher.Flux<SearchHit<T>> search(Query query, Class<?> entityType, Class<T> returnType) Search the index for entities matching the givenquery
.
Unpaged
queries may overrule elasticsearch server defaults for page size by either * delegating to the scroll API or using a max* size
.- Type Parameters:
T
-- Parameters:
query
- 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. Th- Returns:
- a
Flux
emitting matching entities one by one wrapped in aSearchHit
.
-
search
default <T> reactor.core.publisher.Flux<SearchHit<T>> search(Query query, Class<T> entityType, IndexCoordinates index) Search the index for entities matching the givenquery
.- Type Parameters:
T
-- Parameters:
query
- must not be null.entityType
- must not be null.index
- the target index, must not be null- Returns:
- a
Flux
emitting matching entities one by one wrapped in aSearchHit
.
-
search
<T> reactor.core.publisher.Flux<SearchHit<T>> search(Query query, Class<?> entityType, Class<T> resultType, IndexCoordinates index) Search the index for entities matching the givenquery
.- Type Parameters:
T
-- Parameters:
query
- must not be null.entityType
- must not be null.resultType
- the projection result type.index
- the target index, must not be null- Returns:
- a
Flux
emitting matching entities one by one wrapped in aSearchHit
.
-
searchForPage
default <T> reactor.core.publisher.Mono<SearchPage<T>> searchForPage(Query query, Class<T> entityType) Search the index for entities matching the givenquery
.- Parameters:
query
- must not be null.entityType
- must not be null.- Returns:
- a
Mono
emitting matching entities in aSearchHits
. - Since:
- 4.1
-
searchForPage
<T> reactor.core.publisher.Mono<SearchPage<T>> searchForPage(Query query, Class<?> entityType, Class<T> resultType) Search the index for entities matching the givenquery
.- Parameters:
query
- must not be null.entityType
- must not be null.resultType
- the projection result type.- Returns:
- a
Mono
emitting matching entities in aSearchHits
. - Since:
- 4.1
-
searchForPage
default <T> reactor.core.publisher.Mono<SearchPage<T>> searchForPage(Query query, Class<T> entityType, IndexCoordinates index) Search the index for entities matching the givenquery
.- Parameters:
query
- must not be null.entityType
- must not be null.index
- the target index, must not be null- Returns:
- a
Mono
emitting matching entities in aSearchHits
. - Since:
- 4.1
-
searchForPage
<T> reactor.core.publisher.Mono<SearchPage<T>> searchForPage(Query query, Class<?> entityType, Class<T> resultType, IndexCoordinates index) Search the index for entities matching the givenquery
.- Parameters:
query
- must not be null.entityType
- must not be null.resultType
- the projection result type.index
- the target index, must not be null- Returns:
- a
Mono
emitting matching entities in aSearchHits
. - Since:
- 4.1
-
searchForHits
default <T> reactor.core.publisher.Mono<ReactiveSearchHits<T>> searchForHits(Query query, Class<T> entityType) Perform a search and return theReactiveSearchHits
which contains information about the search results and which will provide the documents by theReactiveSearchHits.getSearchHits()
method.- Type Parameters:
T
- the result type class- Parameters:
query
- must not be null.entityType
- must not be null.- Returns:
- a
Mono
emitting theReactiveSearchHits
that contains the search result information - Since:
- 4.4
-
searchForHits
<T> reactor.core.publisher.Mono<ReactiveSearchHits<T>> searchForHits(Query query, Class<?> entityType, Class<T> resultType) Perform a search and return theReactiveSearchHits
which contains information about the search results and which will provide the documents by theReactiveSearchHits.getSearchHits()
method.- Type Parameters:
T
- the result type class- Parameters:
query
- must not be null.entityType
- must not be null.resultType
- the projection result type.- Returns:
- a
Mono
emitting theReactiveSearchHits
that contains the search result information - Since:
- 4.4
-
searchForHits
default <T> reactor.core.publisher.Mono<ReactiveSearchHits<T>> searchForHits(Query query, Class<T> entityType, IndexCoordinates index) Perform a search and return theReactiveSearchHits
which contains information about the search results and which will provide the documents by theReactiveSearchHits.getSearchHits()
method.- Type Parameters:
T
- the result type class- Parameters:
query
- must not be null.entityType
- must not be null.index
- the target index, must not be null- Returns:
- a
Mono
emitting theReactiveSearchHits
that contains the search result information - Since:
- 4.4
-
searchForHits
<T> reactor.core.publisher.Mono<ReactiveSearchHits<T>> searchForHits(Query query, Class<?> entityType, Class<T> resultType, IndexCoordinates index) Perform a search and return theReactiveSearchHits
which contains information about the search results and which will provide the documents by theReactiveSearchHits.getSearchHits()
method.- Type Parameters:
T
- the result type class- Parameters:
query
- must not be null.entityType
- must not be null.resultType
- the projection result type.index
- the target index, must not be null- Returns:
- a
Mono
emitting theReactiveSearchHits
that contains the search result information - Since:
- 4.4
-
aggregate
reactor.core.publisher.Flux<? extends AggregationContainer<?>> aggregate(Query query, Class<?> entityType) Perform an aggregation specified by the givenquery
.- Parameters:
query
- must not be null.entityType
- must not be null.- Returns:
- a
Flux
emitting matching aggregations one by one. - Since:
- 4.0
-
aggregate
reactor.core.publisher.Flux<? extends AggregationContainer<?>> aggregate(Query query, Class<?> entityType, IndexCoordinates index) Perform an aggregation specified by the givenquery
.- Parameters:
query
- must not be null.entityType
- must not be null.index
- the target index, must not be null- Returns:
- a
Flux
emitting matching aggregations one by one. - Since:
- 4.0
-
suggest
Does a suggest query.- Parameters:
query
- the Query containing the suggest definition. Must be currently aNativeSearchQuery
, must not be null.entityType
- the type of the entities that might be returned for a completion suggestion, must not be null.- Returns:
- suggest data
- Since:
- 4.3
-
suggest
reactor.core.publisher.Mono<Suggest> suggest(Query query, Class<?> entityType, IndexCoordinates index) Does a suggest query.- Parameters:
query
- the Query containing the suggest definition. Must be currently aNativeSearchQuery
, 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.- Returns:
- suggest data
- Since:
- 4.3
-
openPointInTime
default reactor.core.publisher.Mono<String> openPointInTime(IndexCoordinates index, Duration keepAlive) Opens a point in time (pit) in Elasticsearch.- Parameters:
index
- the index name(s) to usekeepAlive
- the duration the pit shoult be kept alive- Returns:
- the pit identifier
- Since:
- 5.0
-
openPointInTime
reactor.core.publisher.Mono<String> openPointInTime(IndexCoordinates index, Duration keepAlive, Boolean ignoreUnavailable) Opens a point in time (pit) in Elasticsearch.- Parameters:
index
- the index name(s) to usekeepAlive
- the duration the pit shoult be kept aliveignoreUnavailable
- if {$literal true} the call will fail if any of the indices is missing or closed- Returns:
- the pit identifier
- Since:
- 5.0
-
closePointInTime
Closes a point in time- Parameters:
pit
- the pit identifier as returned byopenPointInTime(IndexCoordinates, Duration, Boolean)
- Returns:
- true on success
- Since:
- 5.0
-
matchAllQuery
Query matchAllQuery()Creates aQuery
to find all documents. Must be implemented by the concrete implementations to provide an appropriate query using the respective client.- Returns:
- a query to find all documents
- Since:
- 4.3
-
idsQuery
Creates aQuery
to find get all documents with given ids. Must be implemented by the concrete implementations to provide an appropriate query using the respective client.- Parameters:
ids
- the list of ids must not be null- Returns:
- query returning the documents with the given ids
- Since:
- 4.3
-