From 2dd29b8d072c7ae86fa310d60571a195c4b853b5 Mon Sep 17 00:00:00 2001 From: Marius Iversen Date: Tue, 27 Aug 2024 20:26:30 +0200 Subject: [PATCH] [8.15] [Automatic Import] resolve a bug in ECS missing fields detection (#191502) (#191526) # Backport This will backport the following commits from `main` to `8.15`: - [[Automatic Import] resolve a bug in ECS missing fields detection (#191502)](https://github.com/elastic/kibana/pull/191502) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) --- .../server/graphs/ecs/validate.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/x-pack/plugins/integration_assistant/server/graphs/ecs/validate.ts b/x-pack/plugins/integration_assistant/server/graphs/ecs/validate.ts index 4695523b14e86..8122b8393f141 100644 --- a/x-pack/plugins/integration_assistant/server/graphs/ecs/validate.ts +++ b/x-pack/plugins/integration_assistant/server/graphs/ecs/validate.ts @@ -22,15 +22,10 @@ function extractKeys(data: AnyObject, prefix: string = ''): Set { // Directly add the key for arrays without iterating over elements keys.add(fullKey); } else if (typeof value === 'object' && value !== null) { - const valueKeys = new Set(Object.keys(value)); - - if ([...valueFieldKeys].every((k) => valueKeys.has(k))) { - keys.add(fullKey); - } else { - // Recursively extract keys if the current value is a nested object - for (const nestedKey of extractKeys(value, fullKey)) { - keys.add(nestedKey); - } + keys.add(fullKey); + // Recursively extract keys if the current value is a nested object + for (const nestedKey of extractKeys(value, fullKey)) { + keys.add(nestedKey); } } else { // Add the key if the value is not an object or is null