# Kibana Alerts configuration - Using ctx.results\[0\].hits.total

**URL:** <https://discuss.elastic.co/t/kibana-alerts-configuration-using-ctx-results-0-hits-total/199085>\
**Category:** Kibana\
**Created:** [September 11, 2019, 1:58pm UTC](https://discuss.elastic.co/t/kibana-alerts-configuration-using-ctx-results-0-hits-total/199085 "2019-09-11T13:58:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bharati](https://avatars.discourse-cdn.com/v4/letter/b/b38774/32.png) [@bharati](https://discuss.elastic.co/u/bharati)\
**Post date:** [September 11, 2019, 1:58pm UTC](https://discuss.elastic.co/t/kibana-alerts-configuration-using-ctx-results-0-hits-total/199085/1 "2019-09-11T13:58:04Z")

</div>

Hi,

Im trying to use the ctx.results[0].hits.total variable as a part of the message of the triggered alert. I have added the alert message content as below

Hi,  
An event has occured.  
Duration:

- from: {{ctx.periodStart}}
- to: {{ctx.periodEnd}}
- count : {{ctx.results[0].hits.total}}  
Thanks,

The total hits is blank in the generated alert message. Please let me know how I can get the total hits in the alert message. Thanks!

---

<div class="post-metadata">

**Author:** ![rashmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rashmi/32/16391_2.png) [@rashmi](https://discuss.elastic.co/u/rashmi)\
**Post date:** [September 11, 2019, 2:44pm UTC](https://discuss.elastic.co/t/kibana-alerts-configuration-using-ctx-results-0-hits-total/199085/2 "2019-09-11T14:44:10Z")

</div>

Hi  
Can you plz post your configured watch ?  
and any associated logs when the watch triggers ? screenshots ? version?

Thanks  
Rashmi

---

<div class="post-metadata">

**Author:** ![peterklijn](https://avatars.discourse-cdn.com/v4/letter/p/ebca7d/32.png) [@peterklijn](https://discuss.elastic.co/u/peterklijn)\
**Post date:** [October 5, 2019, 8:42am UTC](https://discuss.elastic.co/t/kibana-alerts-configuration-using-ctx-results-0-hits-total/199085/3 "2019-10-05T08:42:35Z")

</div>

Try {{ctx.results.0.hits.total}}

---

<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:** [November 2, 2019, 8:42am UTC](https://discuss.elastic.co/t/kibana-alerts-configuration-using-ctx-results-0-hits-total/199085/4 "2019-11-02T08:42:45Z")

</div>

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