From 6ec9af2c2a503f71e1831d38f49b2ca78fb2758e Mon Sep 17 00:00:00 2001 From: Or Ouziel Date: Mon, 24 Jan 2022 09:03:24 +0200 Subject: [PATCH] create dataview only if non exists (#108) --- x-pack/plugins/cloud_security_posture/public/plugin.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/x-pack/plugins/cloud_security_posture/public/plugin.ts b/x-pack/plugins/cloud_security_posture/public/plugin.ts index a9fccb5a1d8bb..284d0180c061a 100755 --- a/x-pack/plugins/cloud_security_posture/public/plugin.ts +++ b/x-pack/plugins/cloud_security_posture/public/plugin.ts @@ -65,6 +65,9 @@ async function registerKubebeatDataView( ) { try { const [, depsStart] = await core.getStartServices(); + const dataView = await depsStart.data.dataViews.find(CSP_KUBEBEAT_INDEX_NAME); + if (dataView) return; + await depsStart.data.dataViews.createAndSave({ title: CSP_KUBEBEAT_INDEX_NAME, allowNoIndex: true,