Skip to content

Clean up how pipeline aggs check for multi-bucket (backport of #54161) #54379

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 30, 2020

Conversation

nik9000
Copy link
Member

@nik9000 nik9000 commented Mar 28, 2020

Pipeline aggregations like stats_bucket, sum_bucket, and
percentiles_bucket only operate on buckets that have multiple buckets.
This adds support for those aggregations to geo_distance, ip_range,
auto_date_histogram, and rare_terms.

This all happened because we used a marker interface to mark compatible
aggs, MultiBucketAggregationBuilder and it was fairly easy to forget
to implement the interface.

This replaces the marker interface with an abstract method in
AggregationBuilder, bucketCardinality which makes you return NONE,
ONE, or MANY. The bucket aggregations can check for MANY. At
this point ONE and NONE amount to about the same thing, but I
suspect that'll be a useful distinction when validating bucket sorts.

Closes #53215

…c#54161)

Pipeline aggregations like `stats_bucket`, `sum_bucket`, and
`percentiles_bucket` only operate on buckets that have multiple buckets.
This adds support for those aggregations to `geo_distance`, `ip_range`,
`auto_date_histogram`, and `rare_terms`.

This all happened because we used a marker interface to mark compatible
aggs, `MultiBucketAggregationBuilder` and it was fairly easy to forget
to implement the interface.

This replaces the marker interface with an abstract method in
`AggregationBuilder`, `bucketCardinality` which makes you return `NONE`,
`ONE`, or `MANY`. The `bucket` aggregations can check for `MANY`. At
this point `ONE` and `NONE` amount to about the same thing, but I
suspect that'll be a useful distinction when validating bucket sorts.

Closes elastic#53215
@nik9000 nik9000 merged commit e58ad9f into elastic:7.x Mar 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant