Adding timeouts to a search with the REST API


(efrendiaz) #1

I'm trying to execute the following command.
curl -XGET 'http://127.0.0.1:9200/5d38fe12-7cc0-42d1-b1aa-9d6309ffe5d5/_search' -d '{
"query" : {
"term" : { "body" : "thanks" }
}, "timeout" : "5s"
}'

and I'm getting this exception

{"error":"SearchPhaseExecutionException[Failed to execute phase [query_fetch], total failure; shardFailures {[zL-8T7m9RXifAGzyzw3dHw][5d38fe12-7cc0-42d1-b1aa-9d6309ffe5d5-0][0]: SearchParseException[[5d38fe12-7cc0-42d1-b1aa-9d6309ffe5d5-0][0]: query[body:thanks],from[-1],size[-1]: Parse Failure [Failed to parse source [{\n "query" : {\n "term" : { "body" : "thanks" }\n }, "timeout" : "5s" \n}]]]; nested: SearchParseException[[5d38fe12-7cc0-42d1-b1aa-9d6309ffe5d5-0][0]: query[body:thanks],from[-1],size[-1]: Parse Failure [No parser for element [timeout]]]; }]","status":500}

I've been looking for examples on how to use the time out with the REST API but I wasn't able to find any.

I appreciate any help anyone can provide.

Thanks.


(system) #2