# Sending all the aggregations Response in multiple lines

**URL:** <https://discuss.elastic.co/t/sending-all-the-aggregations-response-in-multiple-lines/166623>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [January 31, 2019, 5:53pm UTC](https://discuss.elastic.co/t/sending-all-the-aggregations-response-in-multiple-lines/166623 "2019-01-31T17:53:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rajeev\_Prakash](https://avatars.discourse-cdn.com/v4/letter/r/a9a28c/32.png) [@Rajeev\_Prakash](https://discuss.elastic.co/u/Rajeev_Prakash)\
**Post date:** [January 31, 2019, 5:53pm UTC](https://discuss.elastic.co/t/sending-all-the-aggregations-response-in-multiple-lines/166623/1 "2019-01-31T17:53:19Z")

</div>

Hi,

I configured the watcher to generate email alert with transactions counts for every 24 hrs.  
using aggregations I configured the watcher  
"aggs": {  
"2": {  
"terms": {  
"field": "TransactionName.keyword",  
"size": 5,  
"order": {  
"\_count": "asc"  
}  
}  
}  
}  
the response for the watcher is

"aggregations": {  
"2": {  
"doc\_count\_error\_upper\_bound": 0,  
"sum\_other\_doc\_count": 0,  
"buckets": [  
{  
"key": "SAP start",  
"doc\_count": 4519  
},  
{  
"key": " Int Req",  
"doc\_count": 4519  
},  
{  
"key": "SAP Success",  
"doc\_count": 4517  
},  
{  
"key": "SAP Failure",  
"doc\_count": 2  
}  
]  
}  
}

I tried to execute the following line in my watcher but I was able to get in single line  
{{#ctx.payload.aggregations.2.buckets}}{{key}}: {{doc\_count}} {{/ctx.payload.aggregations.2.buckets}}

I want to Execute this result in multiple lines in email alert.

---

<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:** [February 28, 2019, 5:53pm UTC](https://discuss.elastic.co/t/sending-all-the-aggregations-response-in-multiple-lines/166623/2 "2019-02-28T17:53:20Z")

</div>

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