elastic / elasticsearch-php

Official PHP client for Elasticsearch.
https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/index.html
MIT License
35 stars 970 forks source link

$this->client->updateByQuery($params); do not work correctly,error:Trying to create too many scroll contexts #1125

Closed lizhanghu closed 3 years ago

lizhanghu commented 3 years ago

This is my code



$this->client->updateByQuery($params); 

The printed log is

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

- centeros7
- PHP Version 7.1
- ES-PHP client version 7.7
- Elasticsearch version  7.6.2
ezimuel commented 3 years ago

@lizhanghu it seems this is a bug that has been fixed in 7.7 (see https://github.com/elastic/elasticsearch/issues/56202). Can you try to update Elasticsearch and try again? Thanks!

lizhanghu commented 3 years ago

@lizhanghu it seems this is a bug that has been fixed in 7.7 (see elastic/elasticsearch#56202). Can you try to update Elasticsearch and try again? Thanks!

OK, now we have restarted the cluster and it is working properly and we are preparing to upgrade,thanks