# Too many scroll contexts with \_update\_by\_query and/or \_delete\_by\_query

**URL:** <https://discuss.elastic.co/t/too-many-scroll-contexts-with-update-by-query-and-or-delete-by-query/282325>\
**Category:** Elasticsearch\
**Created:** [August 24, 2021, 9:34am UTC](https://discuss.elastic.co/t/too-many-scroll-contexts-with-update-by-query-and-or-delete-by-query/282325 "2021-08-24T09:34:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomkirk](https://avatars.discourse-cdn.com/v4/letter/t/76d3ee/32.png) [@tomkirk](https://discuss.elastic.co/u/tomkirk)\
**Post date:** [August 24, 2021, 9:34am UTC](https://discuss.elastic.co/t/too-many-scroll-contexts-with-update-by-query-and-or-delete-by-query/282325/1 "2021-08-24T09:34:24Z")

</div>

Hello,

I've had an issue recently in my Elasticsearch cluster of getting this error:

`Trying to create too many scroll contexts. Must be less than or equal to: [500]`

None of our `_search` queries use that feature, but I have just discovered that `_update_by_query` and `_delete_by_query` do, with a default window of 5 minutes. There may be a bug in our code which results in them being called too frequently, but I was wondering if anybody knew of the danger of setting that to a low value (say 5 seconds?). Given that it doesn't return the `scroll_id`, I assume the scroll context is only used for the duration of the `_update` or `_delete`?

Equally, is it valid to set it to `0s`? I tested it and it did perform the update, but I'm not sure if it just ignored the value?

---

<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:** [September 21, 2021, 9:35am UTC](https://discuss.elastic.co/t/too-many-scroll-contexts-with-update-by-query-and-or-delete-by-query/282325/2 "2021-09-21T09:35:10Z")

</div>

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