user13674325
user13674325

Reputation: 389

Retrieve aggregations using Spring Data Elasticsearch Reactive Template

We are using Spring Data Elasticsearch Reactive Template

Query searchQuery = new NativeSearchQueryBuilder()
                .withQuery(queryBuilder)
                .withPageable(PageRequest.of(0, 10))
                .addAggregation(AggregationBuilders.terms("categories").field("category"))
                .build();

reactiveElasticsearchTemplate.search(searchQuery, documentType, IndexCoordinates.of(indexName))

In response we have Flux<SearchHit<T>> but there are no methods to retrieve aggregations.

How to retrieve the aggregations?

Upvotes: 2

Views: 1271

Answers (1)

Abacus
Abacus

Reputation: 19471

The ReactiveElasticsearchTemplate has aggregate methods.

See the corresponding API interface

There is no combination of the single entities in a flux and the aggregations in the reactive part.

Upvotes: 2

Related Questions