Unable to use msearch with curl

I'm trying to use _msearch like this:

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

Hi @Guilherme_Mello

Try:

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

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}

enter in arrow.

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

1 Like

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