# ElasticSearch delete\_by\_query: Trying to create too many scroll contexts

**URL:** <https://discuss.elastic.co/t/elasticsearch-delete-by-query-trying-to-create-too-many-scroll-contexts/262627>\
**Category:** Elasticsearch\
**Created:** [January 29, 2021, 10:15am UTC](https://discuss.elastic.co/t/elasticsearch-delete-by-query-trying-to-create-too-many-scroll-contexts/262627 "2021-01-29T10:15:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lankin1](https://avatars.discourse-cdn.com/v4/letter/l/4da419/32.png) [@lankin1](https://discuss.elastic.co/u/lankin1)\
**Post date:** [January 29, 2021, 10:15am UTC](https://discuss.elastic.co/t/elasticsearch-delete-by-query-trying-to-create-too-many-scroll-contexts/262627/1 "2021-01-29T10:15:06Z")

</div>

Hi,  
I am trying to fix this error while running delete\_by\_query API on AWS ElasticSearch:

`Trying to create too many scroll contexts. Must be less than or equal to: [500]. This limit can be set by changing the [search.max_open_scroll_context] setting.`

Changing the search.max\_open\_scroll\_context cluster setting gives back:  
`{"Message":"Your request: '/_cluster/settings' payload is not allowed."}`

I've found that it is possible to send a request for changing that setting to the AWS support team, but it is not my preferred solution since upping the limit might have some negative side affects.

I am using elasticsearch version 7.7. Are there any other solutions to this problem?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![HenningAndersen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/henningandersen/32/48188_2.png) [@HenningAndersen](https://discuss.elastic.co/u/HenningAndersen)\
**Post date:** [January 29, 2021, 12:21pm UTC](https://discuss.elastic.co/t/elasticsearch-delete-by-query-trying-to-create-too-many-scroll-contexts/262627/2 "2021-01-29T12:21:45Z")

</div>

Hi @lankin1 ,

are you doing 100s of `delete_by_query` requests concurrently or just one at the time? Doing other workloads using scroll queries? Does the error happen immediately after you start the `delete_by_query` or after some time? Perhaps look at `_nodes/stats` to see if the number of scroll contexts increase over time.

The error when changing `search.max_open_scroll_context` sounds like a problem with your request to change it, can you paste the request you are trying to do here?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 29, 2021, 1:14pm UTC](https://discuss.elastic.co/t/elasticsearch-delete-by-query-trying-to-create-too-many-scroll-contexts/262627/3 "2021-01-29T13:14:14Z")

</div>

> [@lankin1](#):
>
> AWS Elasticsearch:

Note that we don't support this service here.

BTW did you look at [Cloud by Elastic](https://www.elastic.co/cloud), also available if needed from [AWS Marketplace](https://aws.amazon.com/marketplace/pp/B01N6YCISK) ?

Cloud by elastic is one way to have access to **all features** , all managed by us. Think about what is there yet like Security, Monitoring, Reporting, SQL, Canvas, Maps UI, Alerting and built-in solutions named [Observability](https://www.elastic.co/observability), [Security](https://www.elastic.co/security), [Enterprise Search](https://www.elastic.co/enterprise-search) and what is coming next 🙂 ...

---

<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:** [February 26, 2021, 1:15pm UTC](https://discuss.elastic.co/t/elasticsearch-delete-by-query-trying-to-create-too-many-scroll-contexts/262627/4 "2021-02-26T13:15:04Z")

</div>

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