Hi all,
I needed to update Datafeed on one of my anomaly detection jobs. I stopped the datafeed, updated it by adding appropriate term to bool query, and started the datafeed again. Problem is that anomaly detector was acting like it was still using previous datafeed. I restarted anomaly detection job but that didn't helped either. I had to delete both datafeed and anomally and recreate them and then it finally worked.
Am I doing something wrong? What's the purpose of updating datafeed if it doesn't take any effect?
Anomaly detector:
PUT _xpack/ml/anomaly_detectors/clicks-by-affiliate-campaign
{
"job_id": "clicks-by-affiliate-campaign",
"description": "Clicks by affiliate campaign",
"analysis_config": {
"bucket_span": "1d",
"detectors": [
{
"detector_description": "Clicks by affiliate campaign",
"function": "count",
"by_field_name": "affiliate_campaign",
"detector_index": 0
}
],
"influencers": []
},
"data_description": {
"time_field": "date",
"time_format": "epoch_ms"
}
}
Datafeed ( the "inbound = true" term was added):
PUT _xpack/ml/datafeeds/clicks-by-affiliate-campaign
{
"datafeed_id": "clicks-by-affiliate-campaign",
"job_id": "clicks-by-affiliate-campaign",
"indices": [
"hitpath_clicks*"
],
"types": [],
"query": {
"bool": {
"must": [
{
"range": {
"date": {
"from": "now-30d",
"to": null,
"include_lower": true,
"include_upper": true,
"boost": 1
}
}
},
{
"term": {
"inbound": {
"value": true,
"boost": 1
}
}
}
],
"must_not": [
{
"term": {
"affiliate_id": {
"value": 0,
"boost": 1
}
}
},
{
"term": {
"campaign_id": {
"value": 0,
"boost": 1
}
}
}
],
"adjust_pure_negative": true,
"boost": 1
}
},
"script_fields": {
"affiliate_campaign": {
"script": {
"source": "doc['affiliate_id'].value + ' - ' + doc['affiliate_name.keyword'].value + ' | ' + doc['campaign_id'].value + ' - ' + doc['campaign_name.keyword'].value",
"lang": "painless"
},
"ignore_failure": false
}
},
"scroll_size": 1000,
"chunking_config": {
"mode": "auto"
},
"delayed_data_check_config": {
"enabled": true
}
}