【ELK】elasticsearch中使用脚本报错:scripts of type [inline], operation [update] and lang [groovy] are disabled

查看ID为2的这条数据:

使用更新命令:

使用脚本对年龄+5

curl -XPOST http://192.168.6.16:9200/my_new_index/user/2/_update?pretty -d '{"script" : "ctx._source.age += 5"}'

报错:

"reason" : "scripts of type [inline], operation [update] and lang [groovy] are disabled"

解决方法:

 在es的conf目录下的 elasticsearch.yml 文件添加如下配置:

 script.inline: on
 script.indexed: on

之后重启,再重试该命令

执行成功:

查看

curl -XGET http://192.168.6.16:9200/my_new_index/user/2?pretty

原文地址:https://www.cnblogs.com/sxdcgaq8080/p/11119420.html