Compile error when using script with Terms aggregation

I got the solution by modifying script as below.

def result=[]; def country = doc['country.untouched'].value + '##'; if (doc['location.untouched'].empty) {country + 'null';} else {for(term in doc['location.untouched'].values){result.add(country + term)} return result}

Thanks (y)

1 Like