elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.69k stars 8.24k forks source link

[Lens] layer setting "Use global filters" does not respect local filters set directly on the Lens object #184100

Open jtkarb opened 6 months ago

jtkarb commented 6 months ago

Kibana version: 8.11.3, 8.12.1

Describe the bug: When "Use global filters" is toggled OFF in the layer settings of a Lens visualization, local filtering (via filter buttons or search bar) on the Lens object is not respected. The expectation is for the "Use global filters" toggle to ignore dashboard-level (global) filtering but still apply local filters set on the Lens object itself.

Expected behavior: With "Use global filters" OFF, dashboard-level filters should be ignored, but local filters in the Lens visualization should be applied.

Steps to reproduce:

  1. Create an empty dashboard.
  2. Create a Lens visualization:
    • Turn off "Use global filters" in layer settings.
    • Add a local filter on a data field (e.g., a field used for X-axis buckets).
    • Save the Lens visualization to the dashboard.
  3. On the dashboard, add some filters (using filter buttons, search bar, or controls).
  4. Observe that the Lens visualization ignores the local filter set during creation.

Screenshots: This screenshot illustrates the problem using the data from "Kibana Sample Data Flights": Disregarding-global-filters-also-disregards-local-filtering-on-lens-objects-v2

Summary:

elasticmachine commented 6 months ago

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

teresaalvarezsoler commented 5 months ago

hey @jtkarb I understand your issue with this setting, but can I ask why you need to ignore the global settings at the dashboard level in first place? There can be other solutions rather than using the Ignore global filters that I can recommend if I better understand what your use case is.

jtkarb commented 5 months ago

Hi @teresaalvarezsoler - We need the ability to selectively apply controls to specific visualizations on our dashboard. For instance, consider a benchmarking dashboard that compares the performance metrics of various sites.

We want the top chart to display overall benchmarking performance across all sites, while the charts below should show data for individual sites based on the current site selected in Controls. The Controls should filter the individual site visualizations without affecting the overall benchmarking chart at the top.

This functionality is crucial because if the top benchmarking chart is affected by the controls, it will only display data for the selected site, which is not our intention.

Regardless of our use case, we still believe that the Ignore global filters setting does not currently work as intended.

teresaalvarezsoler commented 5 months ago

Thanks @jtkarb, I guess something like this https://github.com/elastic/kibana/issues/29749 would better fit your needs. We have this in the roadmap but unfortunately, we don't have any dates yet.

In the meantime, the only solution would be to build two different dashboards with different controls and link them together using the links panel (https://www.elastic.co/guide/en/kibana/current/dashboard-links.html) so the user can easily navigate from one to another and it will feel as if they were tabs of the same dashboard.

jtkarb commented 2 months ago

I still find the current implementation of the "Use Global Filters" feature to be unintuitive. When it's set to "OFF," both dashboard-level and visualization-level filters are ignored. However, if the goal is to ignore filters within a specific visualization, it would be more straightforward to simply remove those filters from that visualization—there’s no need to add them in the first place if they serve no purpose.

For time filtering, you've introduced a "Custom Time Range" option in the panel settings, which allows users to apply a specific time filter to individual visualizations, overriding the dashboard's global time filter. This is a useful feature, and I’m essentially requesting a similar capability, but for any field other than @timestamp.

In other words, I’d like the ability to apply dashboard-level controls and filters without impacting specific visualizations where "Use Global Filters" is set to "OFF." However, I still need the filters applied directly to those visualizations to remain intact, as they are essential for accurate metric calculations. In many cases, we need to apply filters within a specific chart to ensure metrics are calculated correctly.

In summary, I'm asking for an option to create visualization objects that can calculate metrics accurately, independent of the dashboard-level filters.