Elasticsearch - search_type as body parameter

I'm struggling a bit with specifying the search_type parameter as the body parameter. As a query parameter, which is fine and works, but didn't find one example in the manual where it is listed as a query parameter.

POST /index/type/_search
{
 "search_type": {"query_then_fetch"}, 
 "explain": false,
     "query" : { 
         "query_string": {
            "default_field": "adress.city",
            "query": "London"
         }
     }
}

      

Any hints?

thank

+3


source to share


1 answer


placing search type in body is not supported, from the documentation :

The type can be customized by setting the search_type parameter to the query string.



So your request should look like this:

curl -XGET http://localhost:9200/index/type/_search?search_type=query_then_fetch -d '
{
 "explain": false,
     "query" : { 
         "query_string": {
            "default_field": "adress.city",
            "query": "London"
         }
     }
}'

      

+3


source







All Articles