【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

 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM