【问题标题】:Elasticsearch 1.3.8 transform with groovy script file使用 groovy 脚本文件进行 Elasticsearch 1.3.8 转换
【发布时间】: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


    【解决方案1】:

    使用脚本文件/etc/elasticsearch/scripts/transform_download_count.groovy 尝试:

    "transform" : {
      "script_file" : "transform_download_count",
      "lang" : "groovy"
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-10-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-29
      相关资源
      最近更新 更多