How to print all the hits from a bucket array of results

I am using Watcher/Alerts to send some emails but it dont seem to find out how to get all keys from an array with out all the array:


<-- this is what my logic said it should work but it didnt :smiley:

"host" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
"doc_count" : 3,
"key" : ""
"doc_count" : 3,
"key" : ""

I have to specify each but i am not sure how to find out how many to iterate but i ithink iterations are not possible here so is there a way just to print the keys? i want to avoid the doc_count?

i know this works


but can i just filter a specific field?

I tried adding a bunch of

{{}} {{}} {{}}

but ill get an out of index array because there isnt 3 every time.


try looping like this


Thanks, i think i found this in another post from you and i wonder if its possible to go a bit higher on the object for example:


This didnt work for me, the idea is to collect diffent subobjects while i am looping.

or what about


i dont seem to find a way to loop like that.

that looping only works on lists. ctx.payload.aggregations is not a list.

ctx.payload.hits.hits is a list and you can then access the elements within like {{}} or {{_index}}. You can only access fields within that single list element.

Thanks :slight_smile:

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