Looping through inner object arrays in painless

for( int i = 0; i < doc['keywords'].size(); i ++ )

My painless for loop above is attempting to execute in a scripted_metric aggregation in the map_script scope. I have a bunch of keyword entries that each have a 'key' (holds a word) and 'value' (holds an integer representing the number of occurrences of that word in another field elsewhere in the doc).

But when executing it I get an IllegalArgumentException with reason 'No field found for [keywords] in mapping with types []'

Is it possible to loop through arrays in json docs indexed in elastic via painless?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.