使用elasticsearch,Elasticsearch Scripts disabled

来源:互联网 发布:淘宝750海报是多大 编辑:程序博客网 时间:2024/06/07 11:44

关键词搜索的时候,报错

Elasticsearch::Transport::Transport::Errors::BadRequest at /micro/complex_search/complex

[400] {"error":{"root_cause":[{"type":"script_exception","reason":"scripts of type [inline], operation [search] and lang [groovy] are disabled"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"development_hospitals_1482752510430","node":"fnwviKt7Q1etguNZ_MqwHg","reason":{"type":"query_parsing_exception","reason":"script_score the script could not be loaded","index":"development_hospitals_1482752510430","line":1,"col":157,"caused_by":{"type":"script_exception","reason":"scripts of type [inline], operation [search] and lang [groovy] are disabled"}}}]},"status":400}


解决办法:

Es 2.2版本中,在查询语句中使用script 时,提示如下错误

scripts of type [inline], operation [aggs] and lang [groovy] are disabled

   

因为新版本的elasticsearch中,基于安全考虑,默认禁用了动态脚本功能.通过修改配置文件开启动态脚本功能

编辑 config/elasticsearch.yml 文件,添加

script.inline: on

script.indexed: on

script.file: on



1 0
原创粉丝点击