# How to get the value in aggregations in watcher

**URL:** <https://discuss.elastic.co/t/how-to-get-the-value-in-aggregations-in-watcher/313526>\
**Category:** Kibana\
**Created:** [September 2, 2022, 8:24am UTC](https://discuss.elastic.co/t/how-to-get-the-value-in-aggregations-in-watcher/313526 "2022-09-02T08:24:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![upreddy](https://avatars.discourse-cdn.com/v4/letter/u/f04885/32.png) [@upreddy](https://discuss.elastic.co/u/upreddy)\
**Post date:** [September 2, 2022, 8:24am UTC](https://discuss.elastic.co/t/how-to-get-the-value-in-aggregations-in-watcher/313526/1 "2022-09-02T08:24:15Z")

</div>

Hi,  
we are trying to create a new watcher for getting total value in perticular field for that which value is select in aggregations.  
"aggs": {  
"abc": {  
"filter": {  
"term": {  
"field": "abc"  
in abc place we need display total field value.

---

<div class="post-metadata">

**Author:** ![jsanz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsanz/32/53734_2.png) [@jsanz](https://discuss.elastic.co/u/jsanz)\
**Post date:** [September 8, 2022, 1:04pm UTC](https://discuss.elastic.co/t/how-to-get-the-value-in-aggregations-in-watcher/313526/2 "2022-09-08T13:04:31Z")

</div>

In this guide in Elastic documentation there is an example on a watcher alert is set up including aggregations

> **[Watching event data | Elasticsearch Guide \[8.4\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/8.4/watching-meetup-data.html)**

The aggregation data (`ctx.payload.aggregations.group_by_city.buckets`) is used in the action email, but not in the alert condition but it should be accessible as well.

Hope it helps.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 6, 2022, 1:05pm UTC](https://discuss.elastic.co/t/how-to-get-the-value-in-aggregations-in-watcher/313526/3 "2022-10-06T13:05:13Z")

</div>

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