当我将此配置添加到/etc/elasticsearch/elasticsearch.yml
在ubuntu虚拟机中;
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'.
这是预期的行为elasticsearch 5.x
。
您不允许在节点级别配置上设置索引级别设置。
来自文档 https://www.elastic.co/guide/en/elasticsearch/reference/5.1/search-request-search-after.html,
默认为 10,000 的 index.max_result_window 是一种保障,
搜索请求占用的堆内存和时间与 from + size 成正比。
如果你检查elasticsearch日志,它会显示类似的内容,
在节点级别配置上找到索引级别设置。
由于elasticsearch 5.x索引级别设置不能在
节点配置,如系统属性中的elasticsearch.yaml
或命令行参数。为了升级所有索引
设置必须通过 /${index}/_settings API 更新。除非全部
设置是动态的,所有索引必须关闭才能应用
将来创建的升级索引应该使用索引模板
设置默认值。
解决方案?
请确保通过执行以下命令更新所有索引上的所有必需值:
curl -XPUT 'http://localhost:9200/_all/_settings?preserve_existing=true' -d '{
"index.max_result_window" : "1000"
}'
OR,
您可以使用索引模板。 https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)