spring-data-elasticsearch
spring-data-elasticsearch copied to clipboard
There is no multiSearch method provided by ReactiveElasticsearchOperations in Spring Data Elasticsearch v4
Expected behavior
I expect ReactiveElasticsearchOperations to provide a multiSearch method that can perform a multi-search request using the reactive Elasticsearch client.
Actual behavior
Currently, there is no multiSearch method provided by ReactiveElasticsearchOperations.
Workaround As a workaround, one can use the StringQuery and create a JSON string that represents a multi-search request. However, this workaround requires manual construction of the multi-search request JSON string, which can be error-prone and cumbersome for complex multi-search requests.
Proposal
I propose to add a multiSearch method to ReactiveElasticsearchOperations that can perform a multi-search request using the reactive Elasticsearch client. This method should simplify the construction of multi-search requests and improve the overall developer experience.
Additional context
Multi-search requests are an important feature of Elasticsearch, and their absence in the reactive Spring Data Elasticsearch v4 library limits the functionality and flexibility of reactive Elasticsearch applications. It is also worth noting that the non-reactive version of Spring Data Elasticsearch already supports multiSearch.
Note: This would probably need to return a Flux<ReactivSearchHits<T>>.
This won't definitely not be added to version 4, as 5.0 is already released, and new features are not backported to old versions.
Would upgrading to Spring Data Elasticsearch 5 require us to adopt Spring Boot 3 and Spring 6? We may not be ready for this upgrade yet and need to evaluate our readiness before making any decisions.
Is there any other workaround available for version 4 of the library, other than manually creating a JSON string? For instance, could we create a list of NativeSearchQuery objects and transform it into a StringQuery object instead?
Would upgrading to Spring Data Elasticsearch 5 require us to adopt Spring Boot 3 and Spring 6?
yes. But this feature would need to be implemented ayway first.
The problem with creating some string query or other work around is, that a multisearch can return different entities for the different queries, that would not be handled.