_update_by_query + script do not work correctly,error:Trying to create too many scroll contexts

2.1k views Asked by At

Elasticsearch version: 7.6.2

JVM:13.0.2

OS version:centeros7

This is my code

POST  recommend_index/_update_by_query  

{
               "script": {
            "source": "ctx._source.rec_doctor_id = 1"
        },
               "query": {
                    "bool": {
                "must": [{
                            "terms": {
                                "id": ["22222"]
                            }
                             }]
                    }
                           }
         }

This code does not return the result correctly,The error message is

{
  "error": {
    "root_cause": [
      {
        "type": "exception",
        "reason": "Trying to create too many scroll contexts. Must be less than or equal to: [5000]. This limit can be set by changing the [search.max_open_scroll_context] setting."
      }
    ],
    "type": "search_phase_execution_exception",
    "reason": "Partial shards failure",
    "phase": "query",
    "grouped": true,
    "failed_shards": [
      {
        "shard": 1,
        "index": "recommend_index",
        "node": "XXX",
        "reason": {
          "type": "exception",
          "reason": "Trying to create too many scroll contexts. Must be less than or equal to: [5000]. This limit can be set by changing the [search.max_open_scroll_context] setting."
        }
      }
    ]
  },
  "status": 500
}

I'm sure the current scroll is 0

When I replace _UPDATE_BY_QUERY with _UPDATE, it updates normally

No change has been made in ES since last Friday, and suddenly an error is reported

No configuration changes have been made to the ES server

1

There are 1 answers

0
user15629057 On

follow-up: I set the search.max_open_scroll_context parameter to 5000 and found nothing to do with it. I looked up the 7.6.2 release and found that someone was having the same problem as me.Link on this here #71354 #56202 I guess this is due to scrolling triggering the 7.6.2 bug.I restarted the cluster node without upgrading and found that it worked!!