From 12bd05a8d7ba263a51d605f54746bac58c944e56 Mon Sep 17 00:00:00 2001 From: klacabane Date: Wed, 28 Jun 2023 12:39:11 +0200 Subject: [PATCH] reverse multi terms assignment --- .../server/lib/accessors/services/index.ts | 1 + .../lib/implicit_collection/collectors/services.ts | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/asset_manager/server/lib/accessors/services/index.ts b/x-pack/plugins/asset_manager/server/lib/accessors/services/index.ts index 417ae149746bb..3fed1047eacba 100644 --- a/x-pack/plugins/asset_manager/server/lib/accessors/services/index.ts +++ b/x-pack/plugins/asset_manager/server/lib/accessors/services/index.ts @@ -18,4 +18,5 @@ export interface ServiceIdentifier { 'asset.ean': string; 'asset.id': string; 'asset.name'?: string; + 'service.environment'?: string; } diff --git a/x-pack/plugins/asset_manager/server/lib/implicit_collection/collectors/services.ts b/x-pack/plugins/asset_manager/server/lib/implicit_collection/collectors/services.ts index 7900a9a067fc7..aef7dc0bf79d2 100644 --- a/x-pack/plugins/asset_manager/server/lib/implicit_collection/collectors/services.ts +++ b/x-pack/plugins/asset_manager/server/lib/implicit_collection/collectors/services.ts @@ -120,14 +120,14 @@ export async function collectServices({ } containerHosts.buckets?.forEach((containerBucket: any) => { - const [containerId, hostname] = containerBucket.key; - if (containerId) { - (service['asset.parents'] as string[]).push(`container:${containerId}`); - } - + const [hostname, containerId] = containerBucket.key; if (hostname) { (service['asset.references'] as string[]).push(`host:${hostname}`); } + + if (containerId) { + (service['asset.parents'] as string[]).push(`container:${containerId}`); + } }); acc.push(service);