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

[Lens] Do not use "Top values" agg for number fields in tables #75279

Closed
flash1293 opened this issue Aug 18, 2020 · 6 comments
Closed

[Lens] Do not use "Top values" agg for number fields in tables #75279

flash1293 opened this issue Aug 18, 2020 · 6 comments
Labels
enhancement New value added to drive a business result Feature:Lens Team:Visualizations Visualization editors, elastic-charts and infrastructure

Comments

@flash1293
Copy link
Contributor

Currently, when dropping a number field in the empty dimension trigger of the data table, it will add a "Top values" column by that field. In most cases this is not the right thing to do, as number fields are commonly shown as a metric.

In this scenario, an average operation for the dropped number field should be added.

@flash1293 flash1293 added enhancement New value added to drive a business result Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:Lens labels Aug 18, 2020
@elasticmachine
Copy link
Contributor

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

@wylieconlon
Copy link
Contributor

I think this is possible within the current suggestion system if we make this change:

  1. The datasource would generate more than one suggestion which uses the number field, it would generate both a metric suggestion and a bucket suggestion. We might need a new suggestionType for this, but probably not.
  2. Visualizations like the XY chart should update their suggestion logic to be smarter about which fields are bucketed or not, so it can continue ranking the metric suggestion higher
  3. The datatable visualization could rank buckets higher

@flash1293
Copy link
Contributor Author

I'm just realizing - As this is happening when you are dragging the field into the dimension trigger on the right side, is the suggestion system even used for that operation? Looks like it simply calls

@wylieconlon
Copy link
Contributor

I think you're right that there is inconsistency with the onDrop function and the overall suggestions- this is a piece of tech debt that has caused bugs before, for example when the onDrop was not selecting the highest-ranked function.

@flash1293
Copy link
Contributor Author

Maybe we have to refactor this to use the suggestion system in that case as well to solve it in a nice way.

As a stopgap measure we could prefer number field metrics to number field buckets if both are possible by the given operation filter. It wouldn't change any apis but it would be pretty hacky within the datasource onDrop logic because the type of the underlying field shouldn't matter to which operation is picked.

Instead of picking the first one here:

check whether the field has a number type and if that's the case, check whether there's a possible metric operation as well.

@flash1293
Copy link
Contributor Author

This is no longer happening - for metrics it will default to median (which makes sense), for buckets it will default to histogram

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New value added to drive a business result Feature:Lens Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects
None yet
Development

No branches or pull requests

3 participants