Yelp / elastalert

Easy & Flexible Alerting With ElasticSearch
https://elastalert.readthedocs.org
Apache License 2.0
7.99k stars 1.74k forks source link

Confused by `num_hits` #3225

Open SHxKM opened 2 years ago

SHxKM commented 2 years ago

I've been trying to understand the meaning of num_hits as it relates (if at all) to num_matches. I understand now that when I get an alert, the num_hits is pretty meaningless as it only says what were the number of hits for the latest query.

But what I don't understand is how, for a given timeframe, say 2021-11-29 22:06 UTC and 2021-11-29 22:16 UTC, reported num_hits is 121, while directly viewing the data in Kibana shows 89 hits. As I understand, hits refers to documents retrieved in a single query, so how can this be possible? from what I gather, num_hits should be at most 89 in this case, but I wouldn't be surprised if I'm wrong.

For reference/context I'm attaching some properties of my rule:

type: frequency
timeframe:
  minutes: 10
num_events: 1
use_count_query: true
doc_type: logs
top_count_keys: ["some_attr"]
top_count_number: 100