Skip to content
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

Allow sorting by median #79839

Merged
merged 8 commits into from
Oct 14, 2020
Merged

Conversation

flash1293
Copy link
Contributor

Fixes #79836

This PR makes it possible to sort by median by prefixing the bucket path in the terms agg with .50. This is necessary because median uses percentiles under the hood which is a multi metric, so it's necessary to point to the specific value within the multi metric.

To handle this, I introduced a new property getValueBucketPath on the agg config which is passed in from the agg type. The default implementation just takes the id, for the median type it's implemented by adding the .50 suffix.

@flash1293 flash1293 marked this pull request as ready for review October 7, 2020 17:16
@flash1293 flash1293 requested a review from a team October 7, 2020 17:16
@flash1293 flash1293 requested a review from a team as a code owner October 7, 2020 17:16
@flash1293 flash1293 added Team:AppArch Team:Visualizations Visualization editors, elastic-charts and infrastructure labels Oct 7, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-arch (Team:AppArch)

Copy link
Contributor

@wylieconlon wylieconlon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and LGTM!

@flash1293
Copy link
Contributor Author

@elasticmachine merge upstream

@ppisljar ppisljar requested a review from lukeelmers October 12, 2020 09:39
@flash1293
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Member

@lukeelmers lukeelmers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the implementation here makes sense, but would be great if we could add a few unit tests, perhaps on terms agg and/or median agg type.

Tested Chrome (macOS), looks good!

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

page load bundle size

id before after diff
data 1.1MB 1.1MB +339.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@flash1293 flash1293 merged commit c529cdc into elastic:master Oct 14, 2020
flash1293 added a commit to flash1293/kibana that referenced this pull request Oct 14, 2020
flash1293 added a commit that referenced this pull request Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:enhancement Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.11.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow sorting by median
5 participants