elastic / kibana

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

[Lens] Axis filters are not consistently applied in drilldown actions for filtered axes #195859

Open simonhearne opened 1 month ago

simonhearne commented 1 month ago

Kibana version: 8.15.2

Elasticsearch version:8.15.2

Server OS version: N/A

Browser version: N/A

Browser OS version: N/A

Original install method (e.g. download page, yum, from source, etc.): ESS

Describe the bug: When creating custom bar charts using filters, these filters are not applied in drilldown actions such as Open in Discover and Apply filter to current view.

Steps to reproduce:

  1. Load Sample Ecommerce Data
  2. Create a new dashboard with a bar chart with at least two vertical axes defined by filters (e.g. Ecommerce Sample Data / filter by customer_gender : "MALE|FEMALE"). Set horizontal axis to filters.
  3. Create a drilldown action to open in discover with filters
  4. Note that applying filter to view only applies the horizontal axis filter
  5. Note that the drilldown action to open in discover applies all axis filters with an OR operator

Expected behavior:

  1. Apply filter to current view should apply the horizontal and vertical axis filters
  2. Open in discover should apply horizontal and selected vertical axis filters

Screenshots (if relevant): Image Image Image

Dashboard JSON

{"attributes":{"description":"","kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[{\"meta\":{\"alias\":\"\\\"category.keyword\\\" : *\",\"type\":\"custom\",\"key\":\"query\",\"disabled\":false,\"negate\":false,\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.filter[0].meta.index\"},\"query\":{\"bool\":{\"must\":[],\"filter\":[{\"bool\":{\"should\":[{\"exists\":{\"field\":\"category.keyword\"}}],\"minimum_should_match\":1}}],\"should\":[],\"must_not\":[]}},\"$state\":{\"store\":\"appState\"}}]}"},"optionsJSON":"{\"useMargins\":true,\"syncColors\":false,\"syncCursor\":true,\"syncTooltips\":false,\"hidePanelTitles\":false}","panelsJSON":"[{\"type\":\"lens\",\"gridData\":{\"x\":0,\"y\":0,\"w\":24,\"h\":15,\"i\":\"c466059f-6818-4223-95d1-95fbd7ac3dba\"},\"panelIndex\":\"c466059f-6818-4223-95d1-95fbd7ac3dba\",\"embeddableConfig\":{\"attributes\":{\"title\":\"Glencore Test\",\"description\":\"\",\"visualizationType\":\"lnsXY\",\"type\":\"lens\",\"references\":[{\"type\":\"index-pattern\",\"id\":\"ff959d40-b880-11e8-a6d9-e546fe2bba5f\",\"name\":\"indexpattern-datasource-layer-cd4a46f7-b890-4b23-b355-3effd1c5610c\"}],\"state\":{\"visualization\":{\"legend\":{\"isVisible\":true,\"position\":\"right\"},\"valueLabels\":\"hide\",\"fittingFunction\":\"None\",\"axisTitlesVisibilitySettings\":{\"x\":true,\"yLeft\":true,\"yRight\":true},\"tickLabelsVisibilitySettings\":{\"x\":true,\"yLeft\":true,\"yRight\":true},\"labelsOrientation\":{\"x\":0,\"yLeft\":0,\"yRight\":0},\"gridlinesVisibilitySettings\":{\"x\":true,\"yLeft\":true,\"yRight\":true},\"preferredSeriesType\":\"bar\",\"layers\":[{\"layerId\":\"cd4a46f7-b890-4b23-b355-3effd1c5610c\",\"accessors\":[\"6ec7d4ff-7cef-4abc-9b8e-1adcdb44d4af\",\"63c5196e-feab-431c-ab78-c47cbeab1c43\"],\"position\":\"top\",\"seriesType\":\"bar\",\"showGridlines\":false,\"layerType\":\"data\",\"colorMapping\":{\"assignments\":[],\"specialAssignments\":[{\"rule\":{\"type\":\"other\"},\"color\":{\"type\":\"loop\"},\"touched\":false}],\"paletteId\":\"eui_amsterdam_color_blind\",\"colorMode\":{\"type\":\"categorical\"}},\"xAccessor\":\"e84f582d-15a5-4b71-b7f6-361814be347f\"}]},\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filters\":[],\"datasourceStates\":{\"formBased\":{\"layers\":{\"cd4a46f7-b890-4b23-b355-3effd1c5610c\":{\"columns\":{\"6ec7d4ff-7cef-4abc-9b8e-1adcdb44d4af\":{\"label\":\"Men\",\"dataType\":\"number\",\"operationType\":\"count\",\"isBucketed\":false,\"scale\":\"ratio\",\"sourceField\":\"___records___\",\"filter\":{\"query\":\"customer_gender : \\\"MALE\\\" \",\"language\":\"kuery\"},\"params\":{\"emptyAsNull\":true},\"customLabel\":true},\"e84f582d-15a5-4b71-b7f6-361814be347f\":{\"label\":\"Genders\",\"dataType\":\"string\",\"operationType\":\"filters\",\"scale\":\"ordinal\",\"isBucketed\":true,\"params\":{\"filters\":[{\"label\":\"\",\"input\":{\"query\":\"\\\"category.keyword\\\" : *\",\"language\":\"kuery\"}}]},\"customLabel\":true},\"63c5196e-feab-431c-ab78-c47cbeab1c43\":{\"label\":\"Women\",\"dataType\":\"number\",\"operationType\":\"count\",\"isBucketed\":false,\"scale\":\"ratio\",\"sourceField\":\"category.keyword\",\"filter\":{\"query\":\"customer_gender : \\\"FEMALE\\\" \",\"language\":\"kuery\"},\"params\":{\"emptyAsNull\":true},\"customLabel\":true}},\"columnOrder\":[\"e84f582d-15a5-4b71-b7f6-361814be347f\",\"6ec7d4ff-7cef-4abc-9b8e-1adcdb44d4af\",\"63c5196e-feab-431c-ab78-c47cbeab1c43\"],\"incompleteColumns\":{},\"sampling\":1}}},\"indexpattern\":{\"layers\":{}},\"textBased\":{\"layers\":{}}},\"internalReferences\":[],\"adHocDataViews\":{}}},\"enhancements\":{\"dynamicActions\":{\"events\":[{\"eventId\":\"4a95e1af-f3ed-4ebc-95e5-1ba5a05df28d\",\"triggers\":[\"FILTER_TRIGGER\"],\"action\":{\"factoryId\":\"OPEN_IN_DISCOVER_DRILLDOWN\",\"name\":\"Open in Discover\",\"config\":{\"openInNewTab\":true}}}]}},\"description\":\"\"},\"title\":\"Filters Test\"}]","timeRestore":false,"title":"Filters Test","version":2},"coreMigrationVersion":"8.8.0","created_at":"2024-10-11T08:11:22.587Z","created_by":"u_Cl0X07Gfgvg0DTl3YJqp6GtK2Lm9cb2eztknHx1bLko_0","id":"bc167db1-dc92-4c8e-a8b7-70a9b42fbb15","managed":false,"references":[{"id":"ff959d40-b880-11e8-a6d9-e546fe2bba5f","name":"kibanaSavedObjectMeta.searchSourceJSON.filter[0].meta.index","type":"index-pattern"},{"id":"ff959d40-b880-11e8-a6d9-e546fe2bba5f","name":"c466059f-6818-4223-95d1-95fbd7ac3dba:indexpattern-datasource-layer-cd4a46f7-b890-4b23-b355-3effd1c5610c","type":"index-pattern"}],"type":"dashboard","typeMigrationVersion":"10.2.0","updated_at":"2024-10-11T08:22:45.032Z","updated_by":"u_Cl0X07Gfgvg0DTl3YJqp6GtK2Lm9cb2eztknHx1bLko_0","version":"WzE0NzY4LDY1XQ=="}
{"excludedObjects":[],"excludedObjectsCount":0,"exportedCount":1,"missingRefCount":0,"missingReferences":[]}
elasticmachine commented 1 month ago

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