【发布时间】:2015-05-06 01:52:38
【问题描述】:
由于 ES 1.3.4 的安全漏洞,我们升级到禁用动态 groovy 脚本的 ES 1.3.9,因此映射转换失败并显示错误消息“禁用 [groovy] 的动态脚本”。我通过将脚本外部化到脚本文件来尝试https://www.elastic.co/guide/en/elasticsearch/reference/1.3/modules-scripting.html 中的方法,但脚本文件没有被调用或转换不起作用。我们如何使用脚本文件来实现转换
映射文件变换如下:
"transform" : [{
"script" : "ctx._source['downloadCountInt'] = (ctx._source['downloadCount']==null)? ctx._source['downloadCount'] : ctx._source['downloadCount'].replaceAll(/\\D/, '');",
"lang" : "groovy"
}]
尝试将脚本 ctx._source['downloadCountInt'] = (ctx._source['downloadCount']==null)? ctx._source['downloadCount'] : ctx._source['downloadCount'].replaceAll(/\\D/, ''); 放入 /etc/elasticsearch/scripts/transform_download_count.groovy 中名为“transform_download_count.groovy”的脚本文件中,日志消息显示它已正确编译,但从未调用过转换。
【问题讨论】:
标签: elasticsearch