From cc840e2d9ca80b7e0db4d79f2a64fd4f064edfc0 Mon Sep 17 00:00:00 2001 From: Carlos Crespo Date: Thu, 4 Apr 2024 12:23:39 +0200 Subject: [PATCH] [Infra][Lens] Remove fields list from the ad-hoc data view object in lens attributes (#179916) Fixes https://github.com/elastic/kibana/issues/171357 ## Summary This PR updates the call to the toSpec function within the Lens attributes builder. The objective is to avoid generating the fields list, which might include the conflictDescriptions field containing arrays of field names. This change aims to reduce the object size, especially when there are numerous conflicts present. The change prevents errors when Lens tries to store the data view object in the session storage in the `navigateToPrefilledEditor` function. ### How to test/reproduce the problem - Start a local Kibana instance - Start a local metricbeat instance with system module enabled (to make the hosts view work) - Run this [script](https://gist.github.com/crespocarlos/4e6d6601446da74f20bbb22ce03e3130) to generate mapping conflicts - Clean the `EMBEDDABLE_STATE_TRANSFER` variable in the session storage - Change the index pattern in Infrastructure settings, including the `test_index*` pattern - Navigate to Infrastructure > Hosts - Open Lens from any chart --- packages/kbn-lens-embeddable-utils/config_builder/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/kbn-lens-embeddable-utils/config_builder/utils.ts b/packages/kbn-lens-embeddable-utils/config_builder/utils.ts index 6f6be44c9c8b..2dcb4205f961 100644 --- a/packages/kbn-lens-embeddable-utils/config_builder/utils.ts +++ b/packages/kbn-lens-embeddable-utils/config_builder/utils.ts @@ -88,7 +88,7 @@ export function buildReferences(dataviews: Record) { const getAdhocDataView = (dataView: DataView): Record => { return { [dataView.id ?? uuidv4()]: { - ...dataView.toSpec(), + ...dataView.toSpec(false), }, }; };