# Retrieving count values and checking threshold using watcher

**URL:** <https://discuss.elastic.co/t/retrieving-count-values-and-checking-threshold-using-watcher/107590>\
**Category:** Elasticsearch\
**Created:** [November 14, 2017, 4:39pm UTC](https://discuss.elastic.co/t/retrieving-count-values-and-checking-threshold-using-watcher/107590 "2017-11-14T16:39:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jessiepi](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@jessiepi](https://discuss.elastic.co/u/jessiepi)\
**Post date:** [November 14, 2017, 4:39pm UTC](https://discuss.elastic.co/t/retrieving-count-values-and-checking-threshold-using-watcher/107590/1 "2017-11-14T16:39:52Z")

</div>

Hello, I am trying to use elastic search to monitor a connection every second and I am trying to set a condition in my watch JSON that takes the count value for each hit and checks to see if it is greater than a threshold I specify. I do not know how to retrieve this value and all I am able to access so far is the ctx.payload.hits.total. What should my condition structure be if I want to check the count at 1 second intervals and compare it to my threshold?

---

<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:** [December 12, 2017, 4:39pm UTC](https://discuss.elastic.co/t/retrieving-count-values-and-checking-threshold-using-watcher/107590/2 "2017-12-12T16:39:53Z")

</div>

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