I have been using ElasticSearch 1.5 before. And in that, there was a scripted metric aggregation with groovy as the language where I was returning a map.
Now, we are working on upgrading to ElasticSearch 5.4 and have converted the same aggregation to Painless. But I am having a problem with the reduce script step. When trying to return a map as the output of the reduce step, it gives a class cast exception.
I also tried returning the string value of the map from the reduce script, in the hopes that I will convert that string to a json object and then to JAVA Map. But the format of the returned string was something like: {616137804988881539={skips=0, notAnswered=0}, 686788170415649923={skips=0, notAnswered=0}}
instead of the usual json format: {616137804988881539:{skips:0, notAnswered:0}, 686788170415649923:{skips:0, notAnswered:0}}
Because of this, json conversion fails.
Can you provide the actual error you get. You say you get a class cast exception, but the actual exception (with stack trace preferably) would be necessary to figure this out.
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.