# Scroll Timeout Minimum Value

**URL:** <https://discuss.elastic.co/t/scroll-timeout-minimum-value/52473>\
**Category:** Elasticsearch\
**Created:** [June 10, 2016, 7:05pm UTC](https://discuss.elastic.co/t/scroll-timeout-minimum-value/52473 "2016-06-10T19:05:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![arcsine](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arcsine/32/7281_2.png) [@arcsine](https://discuss.elastic.co/u/arcsine)\
**Post date:** [June 10, 2016, 7:05pm UTC](https://discuss.elastic.co/t/scroll-timeout-minimum-value/52473/1 "2016-06-10T19:05:23Z")

</div>

I'm attempting to write a unit test that emulates when a scroll query times out. I've set the value using seconds and milliseconds, and it is either being ignored, or there is some minimum threshold in the range of 10s of seconds. I'm not sure if I'm setting values improperly or there is a floor to the value.

---

<div class="post-metadata">

**Author:** ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)\
**Post date:** [June 14, 2016, 9:30am UTC](https://discuss.elastic.co/t/scroll-timeout-minimum-value/52473/2 "2016-06-14T09:30:42Z")

</div>

Hi @arcsine,

how do you specify the timeout? Do you use the `scroll` parameter? This value is not for timing out the network request but for [keeping the scroll context alive](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html#scroll-search-context) (the cluster needs to store information about the current scroll).

Daniel

---

<div class="post-metadata">

**Author:** ![arcsine](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arcsine/32/7281_2.png) [@arcsine](https://discuss.elastic.co/u/arcsine)\
**Post date:** [June 15, 2016, 11:52pm UTC](https://discuss.elastic.co/t/scroll-timeout-minimum-value/52473/3 "2016-06-15T23:52:08Z")

</div>

I'm using the Java API, and basically calling:

```java
SearchResponse scroll = request
    .setScroll(TimeValue.timeValueSeconds(1))
    .setQueryCache(false)
    .get()

```

Where `request` is is a `SearchRequestBuilder`.

The scroll window seems to stay open for much longer than `1s` and much closer to `15s` when I use it.

---

<div class="post-metadata">

**Author:** ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)\
**Post date:** [June 16, 2016, 6:06am UTC](https://discuss.elastic.co/t/scroll-timeout-minimum-value/52473/4 "2016-06-16T06:06:27Z")

</div>

Hi @arcsine,

ok, so you set the scroll timeout. Unfortunately, this does not help with your problem. The scroll timeout does not apply to all requests you issue in the context of a scroll but each time you issue a scroll request (i.e. fetch a new page) so a scroll can stay open for longer than this timeout.

If you use the transport client, can you set [`transport.tcp.connect_timeout`](https://www.elastic.co/guide/en/elasticsearch/reference/2.3/modules-transport.html#_tcp_transport) to a small value (e.g. 50ms) when you create the client?

Daniel

---

<div class="post-metadata">

**Author:** ![arcsine](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arcsine/32/7281_2.png) [@arcsine](https://discuss.elastic.co/u/arcsine)\
**Post date:** [June 16, 2016, 2:12pm UTC](https://discuss.elastic.co/t/scroll-timeout-minimum-value/52473/5 "2016-06-16T14:12:55Z")

</div>

That's a good idea. I will check that out and see if that helps.

---

<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 5, 2017, 10:43pm UTC](https://discuss.elastic.co/t/scroll-timeout-minimum-value/52473/6 "2017-07-05T22:43:13Z")

</div>


