解决办法: 在elasticsearch.yml中加入: script.inline: on script.indexed: on script.engine.groovy.inline.aggs: on