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
参考
https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html