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

**URL:** <https://discuss.elastic.co/t/multisearch-requests-in-new-java-api-do-not-support-sort-or-source-properties/297489>\
**Category:** Elasticsearch\
**Created:** [February 17, 2022, 12:47pm UTC](https://discuss.elastic.co/t/multisearch-requests-in-new-java-api-do-not-support-sort-or-source-properties/297489 "2022-02-17T12:47:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![babayotakun](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/babayotakun/32/64403_2.png) [@babayotakun](https://discuss.elastic.co/u/babayotakun)\
**Post date:** [February 17, 2022, 12:47pm UTC](https://discuss.elastic.co/t/multisearch-requests-in-new-java-api-do-not-support-sort-or-source-properties/297489/1 "2022-02-17T12:47:53Z")

</div>

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

```auto
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?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [February 21, 2022, 2:07pm UTC](https://discuss.elastic.co/t/multisearch-requests-in-new-java-api-do-not-support-sort-or-source-properties/297489/2 "2022-02-21T14:07:20Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Aleksandra\_Jovcheska](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aleksandra_jovcheska/32/98491_2.png) [@Aleksandra\_Jovcheska](https://discuss.elastic.co/u/Aleksandra_Jovcheska)\
**Post date:** [February 24, 2022, 1:42pm UTC](https://discuss.elastic.co/t/multisearch-requests-in-new-java-api-do-not-support-sort-or-source-properties/297489/3 "2022-02-24T13:42:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [February 24, 2022, 2:00pm UTC](https://discuss.elastic.co/t/multisearch-requests-in-new-java-api-do-not-support-sort-or-source-properties/297489/4 "2022-02-24T14:00:07Z")

</div>

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](https://github.com/elastic/elasticsearch-java/issues) ?

Thank you!

--Alex

---

<div class="post-metadata">

**Author:** ![Aleksandra\_Jovcheska](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aleksandra_jovcheska/32/98491_2.png) [@Aleksandra\_Jovcheska](https://discuss.elastic.co/u/Aleksandra_Jovcheska)\
**Post date:** [February 24, 2022, 3:28pm UTC](https://discuss.elastic.co/t/multisearch-requests-in-new-java-api-do-not-support-sort-or-source-properties/297489/5 "2022-02-24T15:28:13Z")

</div>

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

Thank you!  
Regards,  
Aleksandra

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 24, 2022, 3:28pm UTC](https://discuss.elastic.co/t/multisearch-requests-in-new-java-api-do-not-support-sort-or-source-properties/297489/6 "2022-03-24T15:28:59Z")

</div>

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