Elasticsearch索引最大结果窗口配置异常

时间:2017-12-12 06:48:10

标签: elasticsearch configuration

当我在ubuntu vm;

中将此配置添加到/etc/elasticsearch/elasticsearch.yml
index.max_result_window: 1000000

在我重新启动Elasticsearch之后这个配置给我这个例外;

service elasticsearch status

● elasticsearch.service - Elasticsearch    Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; vendor preset: enabled)    Active: failed (Result: exit-code) since Pzt 2017-12-11 11:52:02 +03; 1s ago
     Docs: http://www.elastic.co   Process: 17997 ExecStart=/usr/share/elasticsearch/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid --quiet -Edefault.path.logs=${L   Process: 17994 ExecStartPre=/usr/share/elasticsearch/bin/elasticsearch-systemd-pre-exec (code=exited, status=0/SUCCESS)  Main PID: 17997 (code=exited, status=1/FAILURE)

Ara 11 11:51:55 bilal-VirtualBox systemd[1]: Stopped Elasticsearch. Ara 11 11:51:55 bilal-VirtualBox systemd[1]: Starting Elasticsearch... Ara 11 11:51:55 bilal-VirtualBox systemd[1]: Started Elasticsearch. Ara 11 11:52:02 bilal-VirtualBox systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE Ara 11 11:52:02 bilal-VirtualBox systemd[1]: elasticsearch.service: Unit entered failed state. Ara 11 11:52:02 bilal-VirtualBox systemd[1]: elasticsearch.service: Failed with result 'exit-code'.

1 个答案:

答案 0 :(得分:1)

这是elasticsearch 5.x中的预期行为。 您不能在节点级别配置上设置索引级别设置。

来自documentation

  

默认为10,000的index.max_result_window是一个安全措施,   搜索请求占用堆内存和时间与+大小成比例。

如果您检查elasticsearch日志,它会显示类似

的内容
  

在节点级别配置上找到索引级别设置。

     

由于弹性搜索5.x索引级别设置无法设置   节点配置,如elasticsearch.yaml,在系统属性中   或命令行参数。为了升级所有索引   必须通过/ $ {index} / _ settings API更新设置。除非所有   设置是动态的,必须关闭所有索引才能应用   将来创建的upgradeIndices应该使用索引模板   设置默认值。

<强>解决方案吗

请确保执行以下所有索引更新所有必需值:

curl -XPUT 'http://localhost:9200/_all/_settings?preserve_existing=true' -d '{
  "index.max_result_window" : "1000"
}'

OR,

您可以使用Index Template.