当我在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'.
这是elasticsearch 5.x
的预期行为。您不能在节点级别配置上设置索引级别设置。
index.max_result_window默认为10,000是一个安全措施,搜索请求占用堆内存,时间与+ size成正比。
如果你检查elasticsearch日志,它会显示类似的东西,
在节点级配置上找到索引级别设置。
由于elasticsearch 5.x索引级别设置不能在诸如elasticsearch.yaml之类的节点配置中设置,在系统属性或命令行参数中。为了升级所有索引,必须通过/ $ {index} / _设置更新设置API。除非所有设置都是动态的,否则必须关闭所有索引才能应用将来创建的upgradeIndices应使用索引模板来设置默认值。
解?
请确保通过执行以下内容更新所有索引的所有必需值:
curl -XPUT 'http://localhost:9200/_all/_settings?preserve_existing=true' -d '{
"index.max_result_window" : "1000"
}'
要么,
你可以使用Index Template.