Skip to content

[ML] Support single bucket aggregations in datafeeds #36838

Closed
@davidkyle

Description

@davidkyle

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions