I have a problem regarding a scripted terms aggregation that no longer works since ES 5.X.
I need a terms aggregation on two multivalued fields.
In groovy, I used to do this :
doc['field1'].values + doc['field2'].values
But in Painless, when executing that script, I get
Cannot apply[ + ]operation to types[org.elasticsearch.index.fielddata.ScriptDocValues.Strings]and[org.elasticsearch.index.fielddata.ScriptDocValues.Strings]
This is pretty self explanatory. The problem is that I cannot find anywhere in the doc how I sould proceed.
Concerning that use case, the documentation simply state to "use a script to get the infos from several fields" but do not go on to explain how.
.values gives you a list of values. You need to decide what you want to do with those values (I'm not sure what groovy may have done before, but my guess is merging the lists, then doing a toString later). My guess is you just want them concatenated together, so probably something like this:
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.