From 655ffec956f353b5c6306d305719c1fa8788d48b Mon Sep 17 00:00:00 2001 From: Melissa Date: Tue, 20 Sep 2022 15:57:05 -0600 Subject: [PATCH] ensure all pairs in group are considered in query --- .../aiops/public/application/utils/query_utils.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/aiops/public/application/utils/query_utils.ts b/x-pack/plugins/aiops/public/application/utils/query_utils.ts index 0bfebedae9789..1779b434df508 100644 --- a/x-pack/plugins/aiops/public/application/utils/query_utils.ts +++ b/x-pack/plugins/aiops/public/application/utils/query_utils.ts @@ -52,9 +52,10 @@ export function buildBaseFilterCriteria( const groupFilter = []; if (selectedGroup) { - for (const fieldName in selectedGroup.group) { - if (selectedGroup.group.hasOwnProperty(fieldName)) { - groupFilter.push({ term: { [fieldName]: selectedGroup.group[fieldName] } }); + const allItems = { ...selectedGroup.group, ...selectedGroup.repeatedValues }; + for (const fieldName in allItems) { + if (allItems.hasOwnProperty(fieldName)) { + groupFilter.push({ term: { [fieldName]: allItems[fieldName] } }); } } } @@ -80,7 +81,13 @@ export function buildBaseFilterCriteria( } else if (selectedGroup && !includeSelectedChangePoint) { filterCriteria.push({ bool: { - must_not: [...groupFilter], + must_not: [ + { + bool: { + filter: [...groupFilter], + }, + }, + ], }, }); }