# Adding timeouts to a search with the REST API

**URL:** <https://discuss.elastic.co/t/adding-timeouts-to-a-search-with-the-rest-api/5250>\
**Category:** Elasticsearch\
**Created:** [August 25, 2011, 4:29pm UTC](https://discuss.elastic.co/t/adding-timeouts-to-a-search-with-the-rest-api/5250 "2011-08-25T16:29:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![efrendiaz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/efrendiaz/32/3133_2.png) [@efrendiaz](https://discuss.elastic.co/u/efrendiaz)\
**Post date:** [August 25, 2011, 4:29pm UTC](https://discuss.elastic.co/t/adding-timeouts-to-a-search-with-the-rest-api/5250/1 "2011-08-25T16:29:14Z")

</div>

I'm trying to execute the following command.  
curl -XGET '[http://127.0.0.1:9200/5d38fe12-7cc0-42d1-b1aa-9d6309ffe5d5/\_search](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.

---

<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:** [July 6, 2017, 3:56am UTC](https://discuss.elastic.co/t/adding-timeouts-to-a-search-with-the-rest-api/5250/2 "2017-07-06T03:56:01Z")

</div>


