使用elasticsearch,Elasticsearch Scripts disabled

Anson0727發表於2016-12-27

關鍵詞搜尋的時候,報錯

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



相關文章