How to iterate through Alert buckets

My query response is

{
“_shards”: {
“total”: 1,
“failed”: 0,
“successful”: 1,
“skipped”: 0
},
“hits”: {
“hits”: ,
“total”: {
“value”: 10000,
“relation”: “gte”
},
“max_score”: null
},
“took”: 2,
“timed_out”: false,
“aggregations”: {
“hospital”: {
“doc_count_error_upper_bound”: 0,
“sum_other_doc_count”: 0,
“buckets”: [
{
“1”: {
“value”: 171331
},
“3”: {
“doc_count_error_upper_bound”: -1,
“sum_other_doc_count”: 18833,
“buckets”: [
{
“1”: {
“value”: 20301
},
“doc_count”: 31,
“key”: “UNIVERSITY OF MD BALTIMORE WASHINGTON MEDICAL CENTER”
},
{
“1”: {
“value”: 11617
},
“doc_count”: 31,
“key”: “MEDSTAR SAINT MARY’S HOSPITAL”
},
{
“1”: {
“value”: 9585
},
“doc_count”: 31,
“key”: “HOWARD COUNTY GENERAL HOSPITAL”
},
{
“1”: {
“value”: 7980
},
“doc_count”: 31,
“key”: “UNION HOSPITAL OF CECIL COUNTY”
},
{
“1”: {
“value”: 7797
},
“doc_count”: 31,
“key”: “FREDERICK HEALTH HOSPITAL”
}
]
},
“doc_count”: 18988,
“key”: “hospital”
}
]
}
}
}

and if i use
{{ctx.results.0.aggregations.hospital.buckets.0.3}}

I get back

{doc_count_error_upper_bound=-1, sum_other_doc_count=18833, buckets=[{1={value=20301.0}, doc_count=31, key=UNIVERSITY OF MD BALTIMORE WASHINGTON MEDICAL CENTER}, {1={value=11617.0}, doc_count=31, key=MEDSTAR SAINT MARY’S HOSPITAL}, {1={value=9585.0}, doc_count=31, key=HOWARD COUNTY GENERAL HOSPITAL}, {1={value=7980.0}, doc_count=31, key=UNION HOSPITAL OF CECIL COUNTY}, {1={value=7797.0}, doc_count=31, key=FREDERICK HEALTH HOSPITAL}]}

What I am trying to do is return the list of Hospitals…

Any thoughts?

thanks

try removing the ‘0’ after “results”

Unfortunately that returns nothing…but a good thought

And I did try {{#ctx.results.0.aggregations.hospital.buckets.0.3}}
{{key}}
{{/ctx.results.0.aggregations.hospital.buckets.0.3}} to see if that might iterate but no success there either…