Skip to content

Commit

Permalink
[Infrastructure UI] Remove reduces from Log Threshold Rule (#126402) (#…
Browse files Browse the repository at this point in the history
…126503)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 29879e2)
  • Loading branch information
simianhacker authored Feb 28, 2022
1 parent b988d3b commit 9fc2488
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -324,22 +324,22 @@ const getReducedGroupByResults = (
key: GroupedSearchQueryResponse['aggregations']['groups']['buckets'][0]['key']
) => Object.values(key).join(', ');

const reducedGroupByResults: ReducedGroupByResults = [];
if (isOptimizedGroupedSearchQueryResponse(results)) {
return results.reduce<ReducedGroupByResults>((acc, groupBucket) => {
for (const groupBucket of results) {
const groupName = getGroupName(groupBucket.key);
const groupResult = { name: groupName, documentCount: groupBucket.doc_count };
return [...acc, groupResult];
}, []);
reducedGroupByResults.push({ name: groupName, documentCount: groupBucket.doc_count });
}
} else {
return results.reduce<ReducedGroupByResults>((acc, groupBucket) => {
for (const groupBucket of results) {
const groupName = getGroupName(groupBucket.key);
const groupResult = {
reducedGroupByResults.push({
name: groupName,
documentCount: groupBucket.filtered_results.doc_count,
};
return [...acc, groupResult];
}, []);
});
}
}
return reducedGroupByResults;
};

export const processGroupByResults = (
Expand Down

0 comments on commit 9fc2488

Please sign in to comment.