I'm trying to send elasticserach multi search request via postman as below:
POST - http://localhost:9200/_msearch content-type : x-www-form-urlencoded body: {"index":"accounts"} {"query":{"bool":{"should":[{"match":{"owner.first_name":"Creeple"}}]}}}
However, I'm getting following error:
{ "error": { "root_cause": [ { "type": "parse_exception", "reason": "Failed to derive xcontent" } ], "type": "parse_exception", "reason": "Failed to derive xcontent" }, "status": 400 }
Note that if I perform same request via my play code, results are succesfully fetched.
WS.url("localhost:9200/_msearch").withHeaders("Content-type" -> "application/x-www-form-urlencoded").post(query)
You can use the search API to search and aggregate data stored in Elasticsearch data streams or indices. The API's query request body parameter accepts queries written in Query DSL. The following request searches my-index-000001 using a match query. This query matches documents with a user.id value of kimchy .
There are two ways to connect to your Elasticsearch cluster: Through the RESTful API or through the Java transport client. Both ways use an endpoint URL that includes a port, such as https://ec47fc4d2c53414e1307e85726d4b9bb.us-east-1.aws.found.io:9243 .
Three things are important here:
Body:
Header:
Curl version:
curl -X POST \ http://127.0.0.1:9200/_msearch \ -H 'cache-control: no-cache' \ -H 'content-type: application/x-ndjson' \ -d '{"index":"script","type":"test"} {"query":{"match_all":{}}} '
You can also make your request body be json format and change your Content-Type be application/json, please take a look as below
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With