Skip to content
Advertisement

Migrate ElasticsearchClient#Msearch JavaApi (8.5)

I cannot figure out the new ElasticsearchClient#Msearch Java API for Multi-Search Requests.

In version 7.17 I used the Multisearch request like this:

JavaScript

With the new API, you have to use ElasticsearchClient#mSearch(MsearchRequest request, Class<TDocument> tDocumentClass). In MsearchRequest you can add RequestItem with MsearchRequest.Builder#searches(List<RequestItem> list), however the RequestItem contains MultisearchHeader and MultisearchBody but does not implement anything from the SearchRequest object.

Any suggestion on what I have to change, use ElasticsearchClient#mSearch?

Advertisement

Answer

You can use this simple code to test:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement