# How to create alert monitor where hits is over 100

**URL:** https://discuss.elastic.co/t/how-to-create-alert-monitor-where-hits-is-over-100/244130
**Category:** Kibana
**Tags:** elastic-stack-alerting
**Created:** [August 7, 2020, 7:31am UTC](https://discuss.elastic.co/t/how-to-create-alert-monitor-where-hits-is-over-100/244130 "2020-08-07T07:31:56Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![jamesyone](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@jamesyone](https://discuss.elastic.co/u/jamesyone)
#### Post date: [August 7, 2020, 7:31am UTC](https://discuss.elastic.co/t/how-to-create-alert-monitor-where-hits-is-over-100/244130/1 "2020-08-07T07:31:56Z")

</div>

Hi-  
Currently trying to create alert monitor in kibana where alert comes when count of certain object hits 100. For some reason, a single count triggers an alert... I want to make it so that 100 counts of the certain object than triggers an alert.. is it possible to do so? Would I just add count to the equation?

This is my current equation.. Trying to make it when 100 wafs triggers an alert!

![image](https://us1.discourse-cdn.com/elastic/original/3X/9/e/9e2f2bb50a52b3ada000537502596591dd0e676d.png)

Help is appreciated! Thanks

---

<div class="post-metadata">

### Author: ![sai\_kiran1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sai_kiran1/32/44118_2.png) [@sai\_kiran1](https://discuss.elastic.co/u/sai_kiran1)
#### Post date: [August 7, 2020, 8:59am UTC](https://discuss.elastic.co/t/how-to-create-alert-monitor-where-hits-is-over-100/244130/2 "2020-08-07T08:59:03Z")

</div>

Adding below condition after your search request should do that...

```auto
    "condition": {
        "compare": {
          "ctx.payload.hits.total": {
            "gte": 100
          }
        }
      }

```

Thanks,  
Sai

---

<div class="post-metadata">

### Author: ![jamesyone](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@jamesyone](https://discuss.elastic.co/u/jamesyone)
#### Post date: [August 10, 2020, 9:14am UTC](https://discuss.elastic.co/t/how-to-create-alert-monitor-where-hits-is-over-100/244130/3 "2020-08-10T09:14:18Z")

</div>

> [@sai\_kiran1](#):
>
> ```auto
> "condition": {
> "compare": {
> "ctx.payload.hits.total": {
> "gte": 100
> }
> }
> }
> 
> ```

Hi Sai,

should i put it after aggregations?

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/e/eed01dfb0571daf15288d3fe6adb45523f2cb0d6.png)

---

<div class="post-metadata">

### Author: ![sai\_kiran1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sai_kiran1/32/44118_2.png) [@sai\_kiran1](https://discuss.elastic.co/u/sai_kiran1)
#### Post date: [August 11, 2020, 7:48am UTC](https://discuss.elastic.co/t/how-to-create-alert-monitor-where-hits-is-over-100/244130/4 "2020-08-11T07:48:24Z")

</div>

It Should work before/after aggregations, you can try like mentioned below

```auto
"condition": {
        "compare": {
          "ctx.payload.hits.total": {
            "gte": 100
          }
        }
      },
"aggregations": {}
}

```

Thanks,  
Sai

---

<div class="post-metadata">

### Author: ![jamesyone](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@jamesyone](https://discuss.elastic.co/u/jamesyone)
#### Post date: [August 12, 2020, 5:06am UTC](https://discuss.elastic.co/t/how-to-create-alert-monitor-where-hits-is-over-100/244130/5 "2020-08-12T05:06:50Z")

</div>

Hi Sai,

I tried doing that but its not letting me update.  
Did I do this right?

```
{
"size": 0,
"query": {
    "bool": {
        "filter": [
            {
                "range": {
                    "EdgeEndTimestamp": {
                        "from": "{{period_end}}||-5m",
                        "to": "{{period_end}}",
                        "include_lower": true,
                        "include_upper": true,
                        "format": "epoch_millis",
                        "boost": 1
                    }
                }
            },
            {
                "match_phrase": {
                    "FirewallMatchesActions": {
                        "query": "drop",
                        "slop": 0,
                        "zero_terms_query": "NONE",
                        "boost": 1
                    }
                }
            },
            {
                "match_phrase": {
                    "FirewallMatchesSources": {
                        "query": "waf",
                        "slop": 0,
                        "zero_terms_query": "NONE",
                        "boost": 1
                    }
                }
            }
        ],
        "adjust_pure_negative": true,
        "boost": 1
    }
},
        "condition": {
           "compare": {
           "ctx.payload.hits.total": {
           "gte": 100
      }
    }
  },
"aggregations": {}

```

}

![image](https://us1.discourse-cdn.com/elastic/original/3X/e/0/e0ff56b3143db322f3da50c120c43b3c9a80b1d3.png)

James

---

<div class="post-metadata">

### Author: ![sai\_kiran1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sai_kiran1/32/44118_2.png) [@sai\_kiran1](https://discuss.elastic.co/u/sai_kiran1)
#### Post date: [August 13, 2020, 12:58pm UTC](https://discuss.elastic.co/t/how-to-create-alert-monitor-where-hits-is-over-100/244130/6 "2020-08-13T12:58:39Z")

</div>

James,

My bad, I was assuming the alerting is via watchers where condition can be included in painless script. Am still in 7.6 version and Alerting feature is not available. Sorry for the confusion, do let me know if you find the solution that would help me when we Upgrade.

Thanks,  
Sai

---

<div class="post-metadata">

### Author: ![jamesyone](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@jamesyone](https://discuss.elastic.co/u/jamesyone)
#### Post date: [August 17, 2020, 3:44am UTC](https://discuss.elastic.co/t/how-to-create-alert-monitor-where-hits-is-over-100/244130/7 "2020-08-17T03:44:12Z")

</div>

BUMP

---

<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: [September 14, 2020, 3:44am UTC](https://discuss.elastic.co/t/how-to-create-alert-monitor-where-hits-is-over-100/244130/8 "2020-09-14T03:44:12Z")

</div>

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