Skip to content

Commit

Permalink
ensure all pairs in group are considered in query
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarezmelissa87 committed Sep 20, 2022
1 parent 1d5caa6 commit 655ffec
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions x-pack/plugins/aiops/public/application/utils/query_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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] } });
}
}
}
Expand All @@ -80,7 +81,13 @@ export function buildBaseFilterCriteria(
} else if (selectedGroup && !includeSelectedChangePoint) {
filterCriteria.push({
bool: {
must_not: [...groupFilter],
must_not: [
{
bool: {
filter: [...groupFilter],
},
},
],
},
});
}
Expand Down

0 comments on commit 655ffec

Please sign in to comment.