使用Scripted Metric Aggregation进行聚合时,出现以下错误提示:
nested: QueryParsingException[[my_index] script_score the script could not be loaded]; nested: ScriptException[scripts of type [inline], operation [search] and lang [groovy] are disabled]; .
解决办法, 修改配置文件,启用groovy, 在重启
# tail -n 10 /etc/elasticsearch/elasticsearch.yml
# http server. With this enabled, it may pose a security risk, so disabling
# it unless you need it is recommended (it is disabled by default).
#
#http.jsonp.enable: true
script.groovy.sandbox.enabled: true
script.inline: on
script.indexed: on
script.search: on
script.engine.groovy.inline.aggs: on
# /etc/rc.d/init.d/elasticsearch restart
Stopping elasticsearch: [ OK ]
Starting elasticsearch: [ OK ]
nested: QueryParsingException[[my_index] script_score the script could not be loaded]; nested: ScriptException[scripts of type [inline], operation [search] and lang [groovy] are disabled]; .
解决办法, 修改配置文件,启用groovy, 在重启
# tail -n 10 /etc/elasticsearch/elasticsearch.yml
# http server. With this enabled, it may pose a security risk, so disabling
# it unless you need it is recommended (it is disabled by default).
#
#http.jsonp.enable: true
script.groovy.sandbox.enabled: true
script.inline: on
script.indexed: on
script.search: on
script.engine.groovy.inline.aggs: on
# /etc/rc.d/init.d/elasticsearch restart
Stopping elasticsearch: [ OK ]
Starting elasticsearch: [ OK ]