Multisearch requests in new Java API do not support "sort" or "_source" properties

With brand new Elasticsearch Java API I cannot write multisearch requests like:

curl -H 'Content-type: application/x-ndjson' -XGET 'http://localhost:9200/myindex/_msearch'
-d '{}
{
  "sort": [
    {
      "text": {
        "order": "asc"
      }
    }
  ],
  "_source": false
}
'

This class — "co.elastic.clients.Elasticsearch.core.msearch.MultisearchBody" doesn't have needed properties.
Does this a bug or this was intentional?

1 Like

Just to understand, why do you show an example, that will not work either, because it is not using a single line for request meta data and request body?

If this is about the new Java API, can you share the request you actually did as a code snippet as well the exception stack trace?

Thank you!

Hello @spinscale.

I believe the question is related to the new msearch with Java API. I am experiencing the same problem. With SearchRequest I can set 'sort' property and also 'searchAfter' property. How can I set these properties in the MSearchRequest? It is not supported in both MultisearchHeader and MultisearchBody.

Thank you.
Regards,
Aleksandra

hey Aleksandra,

thanks for clearing that up. That seems indeed an issue. Would you please open an a github issue for the new java client at Issues · elastic/elasticsearch-java · GitHub ?

Thank you!

--Alex

I opened an issue: Multisearch requests in new Java API do not support “sort” or “searchAfter” properties · Issue #170 · elastic/elasticsearch-java · GitHub
Hopefully will get answer soon.

Thank you!
Regards,
Aleksandra

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.