zoukankan      html  css  js  c++  java
  • ES更改参数max_result_window

    今天开发那边说翻页超过10000报错。早上来查阅官网手册,说from/size默认是10000。通过参数index.max_result_window进行控制。那么直接改这个参数即可。

    1、先看看默认配置

    curl -XGET 10.46.2.100:9200/carnoc_jobapply/_settings
    {
      "carnoc_jobapply": {
        "settings": {
          "index": {
            "number_of_shards": "1",
            "provided_name": "carnoc_jobapply",
            "creation_date": "1554089572018",
            "analysis": {
              "ik": {
                "tokenizer": "ik_max_word"
              }
            },
            "number_of_replicas": "1",
            "uuid": "ccF77NAHTfiec5-ugvZPfA",
            "version": {
              "created": "6010299"
            }
          }
        }
      }
    }

    没有具体的值,采用的是默认的参数值10000。

    2、进行更改参数

    curl -XPUT 10.46.2.100:9200/carnoc_jobapply/_settings -d '{ "index.max_result_window" :"500000"}'

    抛了个异常

    {"error":"Content-Type header [application/x-www-form-urlencoded] is not supported","status":406}

    这是由于从ES6.0开始需要指定header头,重新编辑下

    curl -H "Content-Type: application/json" -XPUT 10.46.2.100:9200/carnoc_jobapply/_settings -d '{ "index.max_result_window" :"500000"}'

    返回结果

    {"acknowledged":true}

    3、再次查看参数值

    curl -XGET 10.46.2.100:9200/carnoc_jobapply/_settings

    返回

    {
      "carnoc_jobapply": {
        "settings": {
          "index": {
            "number_of_shards": "1",
            "provided_name": "carnoc_jobapply",
            "max_result_window": "500000",
            "creation_date": "1554089572018",
            "analysis": {
              "ik": {
                "tokenizer": "ik_max_word"
              }
            },
            "number_of_replicas": "1",
            "uuid": "ccF77NAHTfiec5-ugvZPfA",
            "version": {
              "created": "6010299"
            }
          }
        }
      }
    }

    修改成功

    注意:

    1、此方法是设置单索引,如果需要更改索引需要将carnoc_jobapply换成_all

    2、即使换成_all,对于新增的索引,还是默认的10000

    附上参考文件:

    https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html

  • 相关阅读:
    Web测试与App测试的区别
    unittest参数化
    算法-python
    冒泡排序算法-python
    mysql基础知识
    Web自动化-浏览器驱动chromedriver安装方法
    Selenium-三种等待方式
    C++中进制转换问题
    C++11新特性,对象移动,右值引用,移动构造函数
    C++ 拷贝控制和资源管理,智能指针的简单实现
  • 原文地址:https://www.cnblogs.com/binbinyouni/p/10749985.html
Copyright © 2011-2022 走看看