This use case was described in the discuss forum Referencing field name from datafeed aggregation to use as a detector in an ML job
where it is desired to use a filter aggregation in the datafeed.
"aggs": {
"metric1":{
"filter":{"term":{"my_filter_field":"A"}},
"aggs":{
"metric1_value":{"value_count":{"field":"my_filter_field"}}
}
}
The canonical example in the docs is
"aggs" : {
"t_shirts" : {
"filter" : { "term": { "type": "t-shirt" } },
"aggs" : {
"avg_price" : { "avg" : { "field" : "price" } }
}
}
}
The solution is to find single bucket value aggs in AggregationToJsonProcessor and handle them as if they were leaf node aggregations.
This use case was described in the discuss forum Referencing field name from datafeed aggregation to use as a detector in an ML job
where it is desired to use a filter aggregation in the datafeed.
The canonical example in the docs is
The solution is to find single bucket value aggs in AggregationToJsonProcessor and handle them as if they were leaf node aggregations.