Are you sure the above code is exactly what you are compiling and running? I don't think it will compile, since there are missing quote escapes in the script:
@cbismuth I finally got around to debugging this and I was able to reproduce and it is a bug. There is fortunately a workaround. Instead of specifying the params directly on the map script, specify them on the metric agg builder:
final ScriptedMetricAggregationBuilder builder = AggregationBuilders.scriptedMetric("metricName");
builder.mapScript(new Script(ScriptType.INLINE, "painless", "Debug.explain(params.get('enabled'));", Collections.emptyMap() /* note this map will be ignored*/));
builder.params(enabled);
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.