Hi,
I'm on Elastic Cloud v7.7 and I'm exploring the machine learning features.
I have a simple job for monitoring the counts of requests our API endpoint receives over time. The goal is to get alerted when an anomaly occurs. For that, I've created the watcher to send an email on those occasions. My watcher is triggering every 15 min and searches for records with record_score
greater than 50.
The problem I'm facing is that in my emails I receive, the typical
value from the record result is always 0? If I look up the anomaly in Kibana the typical field has a value set (not 0), even if I trigger my watcher by hand (with adjusted time range to get the right time bucket) I get the value.
Here is the screenshot from the original email:
And here is the picture from an email when I triggered the watcher by hand (7 days after the incident):
As you can see now I'm getting the value for the
typical
field?!My question is there some kind of time span (threshold) when the typical value is calculated/pulled for that time bucket?
In my watcher, I'm targeting tie range 'from 17 min ago until 2 min ago' (15 min span with 2 min threshold).
Here are the important parts of my watcher:
{
"trigger": {
"schedule": {
"hourly": {
"minute": [2, 17, 32, 47]
}
}
},
"input": {
"search": {
"request": {
"search_type": "query_then_fetch",
"indices": [
".ml-anomalies-*"
],
"rest_total_hits_as_int": true,
"body": {
"query": {
"bool": {
"filter": [
{
"term": {
"result_type": "record"
}
},
{
"term": {
"job_id": "{{ctx.metadata.job_id}}"
}
},
{
"range": {
"timestamp": {
"gte": "now-{{ctx.metadata.window_period}}-{{ctx.metadata.buffer_period}}",
"lte": "now-{{ctx.metadata.buffer_period}}"
}
}
},
{
"range": {
"record_score": {
"gte": "{{ctx.metadata.min_record_score}}"
}
}
}
]
}
},
"sort": [
{
"record_score": {
"order": "desc"
}
}
]
}
}
}
},
"condition": {
"compare": {
"ctx.payload.hits.total": {
"gt": 0
}
}
},
"actions": {
"send_email": { ... }
}
},
"metadata": {
"min_record_score": 50,
"buffer_period": "2m",
"window_period": "15m",
"job_id": "my_tracker_casa"
},
"transform": {
"script": {
"id": "transform_ml_watcher_payload"
}
}
}
Thanks in advance for any clarification!