-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Description
Kibana version:
main
Describe the bug:
When creating a Lens visualization from via the LensConfigBuilder such as from the new Metrics Explorer in Discover (see below), we extract all the references from the dataviews not respecting which of these dataview are ad-hoc.
ES|QL uses an ad-hoc dataview. In Lens the references is only external references to actual SOs, whereas internalReferences is used for temporary refs such as ad-hoc dataviews.
Expected behavior:
The LensConfigBuilder should correctly differentiate ad-hoc dataview references.
Screenshots (if relevant):
This can lead to an unnecessary error in the UI where it tries to find the ad-hoc dataview that does not actually exist.
Any additional context:
Problematic code...
kibana/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/charts/xy.ts
Lines 281 to 295 in ece283d
| const references = buildReferences(dataviews); | |
| return { | |
| title: config.title, | |
| visualizationType: 'lnsXY', | |
| references, | |
| state: { | |
| datasourceStates, | |
| internalReferences: [], | |
| filters: [], | |
| query: { language: 'kuery', query: '' }, | |
| visualization: buildVisualizationState(config), | |
| // Getting the spec from a data view is a heavy operation, that's why the result is cached. | |
| adHocDataViews: getAdhocDataviews(dataviews), | |
| }, |

