# Elasticsearch 6.3 - SearchRequest timeout value in the SearchSource not honored

**URL:** <https://discuss.elastic.co/t/elasticsearch-6-3-searchrequest-timeout-value-in-the-searchsource-not-honored/183592>\
**Category:** Elasticsearch\
**Created:** [May 30, 2019, 6:34pm UTC](https://discuss.elastic.co/t/elasticsearch-6-3-searchrequest-timeout-value-in-the-searchsource-not-honored/183592 "2019-05-30T18:34:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric\_Ding](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_ding/32/47179_2.png) [@Eric\_Ding](https://discuss.elastic.co/u/Eric_Ding)\
**Post date:** [May 30, 2019, 6:34pm UTC](https://discuss.elastic.co/t/elasticsearch-6-3-searchrequest-timeout-value-in-the-searchsource-not-honored/183592/1 "2019-05-30T18:34:14Z")

</div>

Referring this API doc page:  
[https://www.elastic.co/guide/en/elasticsearch/client/java-rest/6.3/java-rest-high-search.html](https://www.elastic.co/guide/en/elasticsearch/client/java-rest/6.3/java-rest-high-search.html)

```auto
 sourceBuilder.timeout(new TimeValue(60, TimeUnit.SECONDS)); 

```

"Set an optional timeout that controls how long the search is allowed to take."

When I set this value to be 1 millisecond or 1 nanosecond. The search response I got is still with the timedOut flag as false, though the time taken number was 29 (not sure about the unit but guessing it millisecond)

Here is one response I got when I set the timeOut value in the request as **1 nanosecond** :

```auto
{"took":29,"timed_out":false,"_shards":{"total":1110,"successful":1110,"skipped":869,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}

```

The reason I am doing this testing is sometimes we are seeing the response has "timed\_out" flag as "true" in the response and we are trying to see if we could adjust the timeOut value in the search request to reduce that. But first of all is to confirm if those 2 flags are related and it seems they are not.

**Can someone clarify if those two are truly unrelated and how the timedOut flag in the response is set to true?**

---

<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:** [June 27, 2019, 6:34pm UTC](https://discuss.elastic.co/t/elasticsearch-6-3-searchrequest-timeout-value-in-the-searchsource-not-honored/183592/2 "2019-06-27T18:34:18Z")

</div>

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