# How to put the value of {{ctx.payload.aggregations.bucketAgg.buckets.key}} into Watcher body

**URL:** https://discuss.elastic.co/t/how-to-put-the-value-of-ctx-payload-aggregations-bucketagg-buckets-key-into-watcher-body/193694
**Category:** Elasticsearch
**Created:** [August 4, 2019, 8:42pm UTC](https://discuss.elastic.co/t/how-to-put-the-value-of-ctx-payload-aggregations-bucketagg-buckets-key-into-watcher-body/193694 "2019-08-04T20:42:25Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [August 5, 2019, 9:56am UTC](https://discuss.elastic.co/t/how-to-put-the-value-of-ctx-payload-aggregations-bucketagg-buckets-key-into-watcher-body/193694/2 "2019-08-05T09:56:58Z")

</div>

if you look at the JSON, you can see that `aggregations.bucketAgg.buckets` is an array, and thus you cannot just use the `key` field as it is inside an array.

[This example](https://www.elastic.co/guide/en/elastic-stack-overview/7.2/watching-meetup-data.html) in the docs should help to show how to loop through such an array using mustache.

--Alex

---

_[View the full topic](https://discuss.elastic.co/t/how-to-put-the-value-of-ctx-payload-aggregations-bucketagg-buckets-key-into-watcher-body/193694)._
