# How to setup watcher condition ctx.payload.hits.total in percentage?

**URL:** https://discuss.elastic.co/t/how-to-setup-watcher-condition-ctx-payload-hits-total-in-percentage/320593
**Category:** Elasticsearch
**Created:** [December 6, 2022, 2:22pm UTC](https://discuss.elastic.co/t/how-to-setup-watcher-condition-ctx-payload-hits-total-in-percentage/320593 "2022-12-06T14:22:51Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![dharini\_u](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dharini_u/32/114296_2.png) [@dharini\_u](https://discuss.elastic.co/u/dharini_u)
#### Post date: [December 6, 2022, 2:22pm UTC](https://discuss.elastic.co/t/how-to-setup-watcher-condition-ctx-payload-hits-total-in-percentage/320593/1 "2022-12-06T14:22:51Z")

</div>

Hi Folks,

Please help me in setting up a watcher with the below condition:

percentage of ctx.payload.hits.total of variable1 in percentage of variable2 \> 10%

currently the condition is ctx.payload.hits.total \> params.threshold which checks the count .. but i need to calculate the percentage .

Please guide me on this.

Thanks  
Dharini

---

<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: [January 3, 2023, 2:23pm UTC](https://discuss.elastic.co/t/how-to-setup-watcher-condition-ctx-payload-hits-total-in-percentage/320593/2 "2023-01-03T14:23:08Z")

</div>

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