AWS Elastic Search update_by_query : Trying to create too many scroll contexts

I am getting below exception while running the update_by_query. We have been issuing this request to through Rest API (from our code) to OpensearchCluster in AWS.
Initially it seems ok, but when we have a sudden burst of request somewhere around 21k, we started getting this exception.
We have 2 indices and We are using 5 shards and 2 replica per index in OpenSearch.

org.opensearch.common.util.concurrent.OpenSearchRejectedExecutionException: 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.

The sample query looks like below

POST /<index-name>/_update_by_query
  "script": {
     ctx._source[''] =;
    "lang": "painless",
      "name": "ankit gupta"
  "query": {
    "term": {
      "customers.handle.keyword": "date_user01"

  1. Are we getting this exception because we overwhelmed the Opensearch with http requests? We can not use bulk api as an option, as we are updating documents in the indexes whenever there is an event occurred.
  2. Should we use scroll parameter in the term request?
  3. How should we handle it when we have such large number of events happening across the application? What are the best practices to solve such use cases?

OpenSearch/OpenDistro are AWS run products and differ from the original Elasticsearch and Kibana products that Elastic builds and maintains. You may need to contact them directly for further assistance.

(This is an automated response from your friendly Elastic bot. Please report this post if you have any suggestions or concerns :elasticheart: )

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