I am unable to get this to work. I want to find anomalies in the min of a field called timetaken, split by a field called clones.
Based on the documentation you pointed to I tried this for the detector
PUT _xpack/ml/anomaly_detectors/ihs-timetaken-min-agg
{
"analysis_config": {
"bucket_span": "5m",
"detectors": [{
"function":"max",
"field_name":"min.timetaken",
"by_field_name":"clones"
}],
"summary_count_field_name": "doc_count"
},
"data_description": {
"time_field":"max.timestamp"
}
}
and this for the datafeed
PUT _xpack/ml/datafeeds/ihs-timetaken-min-agg-feed
{
"job_id":"ihs-timetaken-min-agg",
"indices": ["copy-ihs-logstash-2017.09.1*"],
"types": [
"_default_",
"access-log"
],
"aggregations": {
"buckets": {
"date_histogram": {
"field": "@timestamp",
"interval": "300s",
"time_zone": "UTC"
},
"aggregations": {
"max.timestamp": {
"max": {"field": "@timestamp"}
},
"clones": {
"terms": {
"field": "clones",
"size": 34
},
"aggregations": {
"min.timetaken": {
"min": {
"field": "web.timetaken"
}
}
}
}
}
}
}
}
Where access-log is the _type of the documents in those indexes. If I _search that aggregation with the query
"query": {
"match_all": {
"boost": 1
}
then the aggregations data that comes back looks OK to me.
"aggregations": {
"buckets": {
"buckets": [
{
"key_as_string": "2017-09-11T23:55:00.000Z",
"key": 1505174100000,
"doc_count": 2,
"clones": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "1stkey",
"doc_count": 1,
"min.timetaken": {
"value": 87281
}
},
{
"key": "2ndkey",
"doc_count": 1,
"min.timetaken": {
"value": 30439
}
}
]
},
"max.timestamp": {
"value": 1505174398000,
"value_as_string": "2017-09-11T23:59:58.000Z"
}
}, [...]
If I then run the job in Kibana from the start of the data to now, I get nothing back and elasticsearch logs the following
[2017-10-02T14:04:17,308][INFO ][o.e.x.m.d.DatafeedManager] Starting datafeed [ihs-timetaken-min-agg-feed] for job [ihs-timetaken-min-agg] in [1970-01-01T00:00:00.000Z, 2017-10-02T18:04:15.001Z)
[2017-10-02T14:04:17,312][WARN ][o.e.x.m.d.DatafeedManager] [ihs-timetaken-min-agg] Datafeed lookback retrieved no data
Any suggestions?