Skip to content

TopMetricsAggregation provides wrong properties and is missing the "missing" property #4342

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

Open
f-loris opened this issue May 5, 2025 · 0 comments

Comments

@f-loris
Copy link

f-loris commented May 5, 2025

🐛 Wrong type

The missing for TopMetricsAggregation is defined per field and not per aggregation. Currently, it is only possible to define the field but no missing property.


see https://www.elastic.co/docs/reference/aggregations/search-aggregations-metrics-top-metrics#_missing

Besides that, TopMetricsAggregation inherits from MetricAggregationBase which wrongly inherits a missing and script, which are both not available according to https://www.elastic.co/docs/reference/aggregations/search-aggregations-metrics-top-metrics . Note, the missing is wrongly available per aggregation and not per field.

Definition

As a first solution to at least provide support for a proper definition of missing, the TopMetricsValue needs to be extended by missing: FieldValue:

export class TopMetricsValue {
  field: Field
  missing: FieldValue;
}

Changing the inheritance from MetricAggregationBase might have further implications I'm not aware of.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant