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] support both sorting and array values on last value dimensions #167528

Open
drewdaemon opened this issue Sep 28, 2023 · 2 comments
Open

[Lens] support both sorting and array values on last value dimensions #167528

drewdaemon opened this issue Sep 28, 2023 · 2 comments
Labels
enhancement New value added to drive a business result Feature:Lens impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. Team:Visualizations Visualization editors, elastic-charts and infrastructure

Comments

@drewdaemon
Copy link
Contributor

Describe the feature:
When users are dealing with a Last value dimension, they currently have the choice between displaying array values and allowing the dimension to be used as the sort-by for a top values dimension.

Not supporting array values
Screenshot 2023-09-28 at 9 14 42 AM

Supporting array values
Screenshot 2023-09-28 at 9 14 53 AM

While it wasn't the original reason we added this, the tradeoff actually makes sense because it is not clear how sorting by array values should work. It could

  • use the first value of the array
  • apply a function over the array (max, median, etc.)
  • many other options

However, the behavior when not supporting array values is currently not ideal. The displayed values are computed from each array based on an undefined Elasticsearch operation. When users attempt to filter by these values, they see strange behavior since the filtered values don't actually exist in the data.

Instead of providing the tradeoff switch, we should support sorting by array values by making the sorting behavior explicit.

  • Remove the switch
  • Display how the array values are being used to sort the terms
  • Allow the user to change which strategy is used

This will allow us to both order top values by a last value dimension and display correct values

@drewdaemon drewdaemon added enhancement New value added to drive a business result Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:Lens impact:needs-assessment Product and/or Engineering needs to evaluate the impact of the change. labels Sep 28, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-visualizations (Team:Visualizations)

@drewdaemon drewdaemon changed the title [Lens] remove last value "Show array values" switch [Lens] support both sorting and array values on last value dimensions Sep 28, 2023
@ppisljar
Copy link
Member

ppisljar commented Oct 4, 2023

if i understand the issue correctly, the problem with top hits is that it does not support sorting ?
one way to work around that would be to keep using top hits, then create a runtime field (on-the-fly) that reduces the multivalue field into a single value (average, sum, min, max, count of values. ...) and then use that field for sorting.

i am guessing es does a similar thing behind the scenes in top metrics agg (reduces the multivalue field using average) so it can sort on that value.

in lens this could happen completely transparent to the user.

@timductive timductive added impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. and removed impact:needs-assessment Product and/or Engineering needs to evaluate the impact of the change. labels Oct 4, 2023
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 impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects
None yet
Development

No branches or pull requests

6 participants