# Question regarding the timeout option in search query

**URL:** https://discuss.elastic.co/t/question-regarding-the-timeout-option-in-search-query/267460
**Category:** Elasticsearch
**Created:** [March 17, 2021, 9:17am UTC](https://discuss.elastic.co/t/question-regarding-the-timeout-option-in-search-query/267460 "2021-03-17T09:17:19Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![iverson1407](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/iverson1407/32/84085_2.png) [@iverson1407](https://discuss.elastic.co/u/iverson1407)
#### Post date: [March 17, 2021, 9:17am UTC](https://discuss.elastic.co/t/question-regarding-the-timeout-option-in-search-query/267460/1 "2021-03-17T09:17:19Z")

</div>

When we set up the timeout in a search query, it will timeout if it goes beyond the threshold. ( I know it is kinda best effort value).

My question about this is that, once the search query gets timeout, will the execution of query also get cancelled? Or it just early returns the result to the caller but it will continue its execution and keep consuming the resources.

If the answer is the latter one, is there any way to also early terminate the query execution if the query is quite expensive and takes so long? (Other than that manually killing the task id like [Search APIs | Elasticsearch Reference [6.8] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/search.html#global-search-cancellation) suggests)

Thanks in advance.

---

<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: [April 14, 2021, 9:17am UTC](https://discuss.elastic.co/t/question-regarding-the-timeout-option-in-search-query/267460/2 "2021-04-14T09:17:40Z")

</div>

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