Query DSL parse elements

Hi Team,
I am working on watcher and need some help to retrieve query result set. how can we parse elements from result payloads?

I updated my query and make it time bound but still getting multiple events in the result set, which are in the form of hits elements, PFB. I can read it in "action" section by mentioning 0,1,2,3 elements but how can i make it generic? to send all elements in action body?


looking for something like input.payload.hits.hits.X.xyz, where X will be 0,1,2,.. N.

Thanks & Regards


you can use mustache to iterate through a list, see https://www.elastic.co/guide/en/elasticsearch/reference/2.3/search-template.html#_passing_an_array_of_strings

you can use sth like