Skip to content

Allow sorting by median#79839

Merged
flash1293 merged 8 commits intoelastic:masterfrom
flash1293:allow-medion-sorting
Oct 14, 2020
Merged

Allow sorting by median#79839
flash1293 merged 8 commits intoelastic:masterfrom
flash1293:allow-medion-sorting

Conversation

@flash1293
Copy link
Copy Markdown
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 Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// labels Oct 7, 2020
@elasticmachine
Copy link
Copy Markdown
Contributor

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

@elasticmachine
Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

@elasticmachine merge upstream

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

@elasticmachine merge upstream

Copy link
Copy Markdown
Contributor

@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
Copy Markdown
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 Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// 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