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
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
simianhacker and kibanamachine authored Feb 28, 2022
1 parent b364576 commit 29879e2
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -333,22 +333,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 29879e2

Please sign in to comment.