Skip to content

KQL/Kuery support for TSVB, timelion and Vega visualizations #17722

@stacey-gammon

Description

@stacey-gammon

Currently none of the above visualizations listen for KQL/Kuery queries, if that feature is enabled.

screen shot 2018-04-16 at 1 08 43 pm

screen shot 2018-04-16 at 1 09 21 pm

The reason for this is the usage of the broken dashboard_context for generating the DSL for a query. This plainly ignores if the query is actually written in KQL/Kquery.

This class should be removed completely and rather the correct way of implementing this should be used:

The request handler of a visualization will get passed in the filters and query in the params object (2nd argument to the request handler). Every visualization should use that query and filters instead of trying to access any global state (like dashboard_context does). Accessing global state in any visualization will break other features that we are planning like Custom time ranges per dashboard panel (#17776). It's an anti pattern that makes the whole architecture unstable and hard to maintain.

A visualization needs to look into filters/queries passed to it's request handler. To compile the query, there are APIs for Lucene and Kuery. We should imho look into creating one central "Query API" (cc @elastic/kibana-discovery), that accepts any query object and that itself will check what query type that query is and use the appropriate compiler. That way we don't duplicate that work into each individual visualization.

That compiled DSL needs then to be merged into the query done by the appropriate visualization. Since KQL/Kuery needs to be compiled against an index pattern, all visualizations need to figure out the appropriate index pattern, for their given index pattern string (maybe we could move that into the Query compile API?).

Metadata

Metadata

Assignees

Labels

Feature:DashboardDashboard related featuresFeature:TSVBTSVB (Time Series Visual Builder)Feature:TimelionTimelion app and visualizationFeature:VegaVega visualizationsTeam:VisualizationsTeam label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t//

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions