# Search timeout doesn't work

**URL:** <https://discuss.elastic.co/t/search-timeout-doesnt-work/376809>\
**Category:** Elasticsearch\
**Created:** [April 5, 2025, 4:10am UTC](https://discuss.elastic.co/t/search-timeout-doesnt-work/376809 "2025-04-05T04:10:42Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Musab\_Dogan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/musab_dogan/32/70691_2.png) [@Musab\_Dogan](https://discuss.elastic.co/u/Musab_Dogan)\
**Post date:** [April 5, 2025, 9:39pm UTC](https://discuss.elastic.co/t/search-timeout-doesnt-work/376809/2 "2025-04-05T21:39:44Z")

</div>

Yes, it’s possible for the query to exceed the allocated timeout parameter. This behaviour explained in the documentation.

> It’s important to know that the timeout is still a best-effort operation; it’s possible for the query to surpass the allotted timeout. There are two reasons for this behavior:
> 
> 1. Timeout checks are performed on a per-document basis. However, some query types have a significant amount of work that must be performed **before** documents are evaluated. This "setup" phase does not consult the timeout, and so very long setup times can cause the overall latency to shoot past the timeout.
> 2. Because the time is once per document, a very long query can execute on a single document and it won’t timeout until the next document is evaluated. This also means poorly written scripts (e.g. ones with infinite loops) will be allowed to execute forever.

> **[Search Options | Elasticsearch: The Definitive Guide \[2.x\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/guide/current/_search_options.html#_timeout_2)**

**If you need a hard timeout in your application, you need to do it on the client side.**

> [@Elastic Timeout not working](https://discuss.elastic.co/t/elastic-timeout-not-working/314791/2):
>
> Elasticsearch only checks for a timed-out request at certain points during execution of the query, and only covers certain aspects of the execution. It also doesn't account for network delays etc. If you need a hard timeout in your application, you need to do it on the client side.

---

_[View the full topic](https://discuss.elastic.co/t/search-timeout-doesnt-work/376809)._
