I am using a Reactive client for Elasticsearch. Both of them (ReactiveElasticsearchTemplate or ReactiveCrudRepository) have support for Flux/Mono and this is working fine for me.
My current problem is that using ReactiveElasticsearchTemplate:
return reactiveElasticsearchTemplate.search(
new NativeSearchQueryBuilder()
.withPageable(PageRequest.of(0, 10))
.build(),
UserDocument.class
)
It is returning slice, but I don't have any information about total elements, as method signature returns Flux<SearchHit<UserDocument>>. Ideally, I would like to get SearchHits or something similar, but I don't know how to achieve it.