Skip to content

Allow composite agg keys to be selected inside bucket selector #36853

Closed
@costin

Description

@costin

bucket_path syntax allows for retrieving the current count, number of buckets and lastly the value of the current bucket through _bucket.
However it doesn't seem to work (as far as I can tell) for composite agg as it cannot unwrap the map of keys used internally by the agg:

Take for example the following query:

"aggregations": {
 "groupby": {
  "composite": {
   "sources": [{
     "31": {
      "date_histogram": {
       "field": "birth_date"
       ...
      }
     }
    }
   ]
  },
  "aggregations": {
   "having.8": {
    "bucket_selector": {
     "buckets_path": {
      "g0": "_key"
     }
    }
   }
  }
 }
}

this returns:
"buckets_path must reference either a number value or a single value numeric metric aggregation, got: org.elasticsearch.search.aggregations.bucket.composite.InternalComposite.ArrayMap"

and any other variation such as "31", "31>_key", "31#_key", "_key[31]", "_key#31" returns "agg not found"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions