elasticsearch - 如何在elasticsearch中配置 "search.max_open_scroll_context"?

标签 elasticsearch

我使用scroll来获取elasticsearch中的数据(版本:7.0.0)。然而,当我使用它时,抛出了异常。

  • 请求:
GET /index-name/_search?scroll=1m
{
    "size": 100,
    "query": {
        "match_all" : {}
    }
}
  • 回复
{
  "error": {
    "root_cause": [
      {
        "type": "exception",
        "reason": "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."
      }
    ],
    "type": "search_phase_execution_exception",
    "reason": "all shards failed",
    "phase": "query",
    "grouped": true,
    "failed_shards": [
      {
        "shard": 0,
        "index": "nr-v1",
        "node": "jVqXndodRtqsZ4Srh9eHSg",
        "reason": {
          "type": "exception",
          "reason": "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."
        }
      }
    ]
  },
  "status": 500
}

我使用 GET/_nodes/stats/indices/search 检查节点状态,响应:

{
  "_nodes": {
    "total": 3,
    "successful": 3,
    "failed": 0
  },
  "cluster_name": "bprc",
  "nodes": {
    "AdT9tX_jRqiuRyNnYunRdg": {
      "timestamp": 1557036722528,
      "name": "es2",
      "transport_address": "192.168.99.74:9300",
      "host": "192.168.99.74",
      "ip": "192.168.99.74:9300",
      "roles": [
        "master",
        "data",
        "ingest"
      ],
      "attributes": {
        "ml.machine_memory": "16819453952",
        "ml.max_open_jobs": "20",
        "xpack.installed": "true"
      },
      "indices": {
        "search": {
          "open_contexts": 502,
          "query_total": 3171,
          "query_time_in_millis": 2490,
          "query_current": 0,
          "fetch_total": 538,
          "fetch_time_in_millis": 951,
          "fetch_current": 0,
          "scroll_total": 2020,
          "scroll_time_in_millis": 1948250008,
          "scroll_current": 502,
          "suggest_total": 0,
          "suggest_time_in_millis": 0,
          "suggest_current": 0
        }
      }
    },
......

我的问题: 1.如何解决“尝试创建太多滚动上下文。必须小于或等于:[500]。”异常问题

  •           "scroll_total": 2020,
              "scroll_time_in_millis": 1948250008,
              "scroll_current": 502
    
  • 这三个属性的作用是什么?

    最佳答案

    我能够通过增加滚动上下文的最大数量来解决这个问题:

    curl -x "" -X PUT localhost:9200/_cluster/settings -H 'Content-Type: application/json' -d'{
        "persistent" : {
            "search.max_open_scroll_context": 1024
        },
        "transient": {
            "search.max_open_scroll_context": 1024
        }
    }'
    

    关于elasticsearch - 如何在elasticsearch中配置 "search.max_open_scroll_context"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55989369/

    相关文章:

    solr - 如何标记由两个没有空格的单词组合而成的单词

    datetime - 插入日期为epoch_seconds,输出为格式化日期

    elasticsearch - 首先获取包含搜索词的文档,然后获取其同义词[Elastic]

    Elasticsearch 批量 API - 意外的输入结束 : expected close marker for ARRAY

    python - Elasticsearch 不提供页面大小较大的数据

    reactjs - ReactiveSearch、ES 和 CORS

    elasticsearch - query_string 的模糊性被忽略

    json - 弹性query_string返回不需要的值

    javascript - 使用 Elasticsearch 的小部件示例

    mongodb全文检索策略