-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
Implement TopOne metrics aggregations #62801
Comments
Considering the above problem, implementing a Like the Also, new New
Which yields a response like:
Because new |
I would like to implement this feature, but I'm Not sure if it's a good design to implement the top_one metrics aggregation. Or the previos first/last metrics aggregation may be better? |
Pinging @elastic/es-analytics-geo (:Analytics/Aggregations) |
Hiya @stfaun, thanks for opening this issue! I'm going to mark this as team-discuss, so that the analytics team can chat about it. I think it's an interesting use-case, but I'm personally not sure if it'd be better served as a modification to Will write back once we've discussed! |
Hiya @stfaun, we chatted about this and were curious if a filter aggregation + exists query would solve your needs? The filter aggregation will ensure that all documents inside the bucket match the provided query/filter, and the exists query can be used to ensure that all documents have the desired field (so that the "top one" document doesn't have a null value). You can then use the |
Hi @polyfractal, the solution you suggests does work for me. I have been confirm that it can be use in the Thanks for your replies. |
Relates to #35639
At the beginning, I think new
first
/last
metric aggregations should be implemented as aSingleValue
metrics aggregation to support the feature.But the
first
/last
metrics aggregations seem to be redundant. They can be combined as atop
metrics aggregation.I have found that
top_metrics
metrics aggregations may be appropriate for my requirement. But when the first sorted document has no value for the target field, thetop_metrics
metrics aggregations will return null value as the result rather than ignoring it.I understand the feature for
top_metrics
metrics aggregations. Atop_metrics
metrics aggregations may return several fields at the same time. So it should not ignore any doc for the bucket.The text was updated successfully, but these errors were encountered: