# Unable to use msearch with curl

**URL:** <https://discuss.elastic.co/t/unable-to-use-msearch-with-curl/315713>\
**Category:** Elasticsearch\
**Created:** [October 3, 2022, 6:28pm UTC](https://discuss.elastic.co/t/unable-to-use-msearch-with-curl/315713 "2022-10-03T18:28:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guilherme\_Mello](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/guilherme_mello/32/100083_2.png) [@Guilherme\_Mello](https://discuss.elastic.co/u/Guilherme_Mello)\
**Post date:** [October 3, 2022, 6:28pm UTC](https://discuss.elastic.co/t/unable-to-use-msearch-with-curl/315713/1 "2022-10-03T18:28:26Z")

</div>

I'm trying to use \_msearch like this:

```auto
curl -XGET "https://host.com/index/_msearch" -H "Content-Type: application/json" -d'
    { }
    {"query" : {"match" : { "title": "vestido"}}, "from":0,"size":2 }
    '

```

But I get this error:  
"error":{"root\_cause":[{"type":"illegal\_argument\_exception","reason":"key [query] is not supported in the metadata section"}],"type":"illegal\_argument\_exception","reason":"key [query] is not supported in the metadata section"},"status":400}%

What's wrong with the curl body?  
Thanks

---

<div class="post-metadata">

**Author:** ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)\
**Post date:** [October 3, 2022, 7:26pm UTC](https://discuss.elastic.co/t/unable-to-use-msearch-with-curl/315713/2 "2022-10-03T19:26:28Z")

</div>

Hi @Guilherme_Mello

Try:

```auto
curl -XGET "https://host.com/index/_msearch?pretty" -H "Content-Type: application/json" -d'
{"query" : {"match" : { "title": "vestido"}}, "from":0,"size":2 }
'

```

---

<div class="post-metadata">

**Author:** ![Guilherme\_Mello](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/guilherme_mello/32/100083_2.png) [@Guilherme\_Mello](https://discuss.elastic.co/u/Guilherme_Mello)\
**Post date:** [October 3, 2022, 7:42pm UTC](https://discuss.elastic.co/t/unable-to-use-msearch-with-curl/315713/3 "2022-10-03T19:42:18Z")

</div>

Hi Andre!

I got this error:  
`{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"The msearch request must be terminated by a newline [\n]"}],"type":"illegal_argument_exception","reason":"The msearch request must be terminated by a newline [\n]"},"status":400}`

---

<div class="post-metadata">

**Author:** ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)\
**Post date:** [October 3, 2022, 7:55pm UTC](https://discuss.elastic.co/t/unable-to-use-msearch-with-curl/315713/4 "2022-10-03T19:55:37Z")

</div>

> [@RabBit\_BR](#):
>
> ```auto
> {"query" : {"match" : { "title": "vestido"}}, "from":0,"size":2 } >>>>>>
> ' <<<<<<<<
> 
> ```

enter in arrow.

---

<div class="post-metadata">

**Author:** ![Guilherme\_Mello](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/guilherme_mello/32/100083_2.png) [@Guilherme\_Mello](https://discuss.elastic.co/u/Guilherme_Mello)\
**Post date:** [October 3, 2022, 8:25pm UTC](https://discuss.elastic.co/t/unable-to-use-msearch-with-curl/315713/5 "2022-10-03T20:25:59Z")

</div>

Man, the problem was with my editor not making a new line.  
Thank you so much.

---

<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:** [October 31, 2022, 8:26pm UTC](https://discuss.elastic.co/t/unable-to-use-msearch-with-curl/315713/6 "2022-10-31T20:26:31Z")

</div>

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