# Watcher unable to send number of hits in email

**URL:** <https://discuss.elastic.co/t/watcher-unable-to-send-number-of-hits-in-email/274292>\
**Category:** Kibana\
**Tags:** elastic-stack-alerting\
**Created:** [May 28, 2021, 6:49am UTC](https://discuss.elastic.co/t/watcher-unable-to-send-number-of-hits-in-email/274292 "2021-05-28T06:49:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tuli](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@tuli](https://discuss.elastic.co/u/tuli)\
**Post date:** [May 28, 2021, 6:49am UTC](https://discuss.elastic.co/t/watcher-unable-to-send-number-of-hits-in-email/274292/1 "2021-05-28T06:49:42Z")

</div>

Hello,

We have a watcher which is sending a CSV attachment with the number of hosts matching the condition. However, we also want it writes in the body the total number of hits/hosts in the CSV found.

For eg: if in the CSV it found 50 hosts then it should send in body 50 hosts found.

We tried using `{{ctx.payload.hits.total}}`, but this is not giving the correct data or number of data in the CSV. It is giving a very high number.

Please let us know how can we achieve this.

---

<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:** [May 31, 2021, 8:50am UTC](https://discuss.elastic.co/t/watcher-unable-to-send-number-of-hits-in-email/274292/2 "2021-05-31T08:50:10Z")

</div>

can you share the search request as well as response of your search query. It is possible, that there are so many hits, but you are only returning the first 50.

---

<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:** [June 28, 2021, 8:50am UTC](https://discuss.elastic.co/t/watcher-unable-to-send-number-of-hits-in-email/274292/3 "2021-06-28T08:50:32Z")

</div>

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