Function to merge multiple aggregations results from different result sets. Explicitly assumed that sets can contain overlapping aggregations that should be merged. Also explicitly assumed that they can contain aggregation values that are undefined or null (0 is valid), and/or contain entire aggregation result sets that are empty or falsey


Parameter Type Default Notes
aggs Optional IAggregationResult[][] []

a list of aggregation result sets from different requests/sources

mergeFunction Optional mergeFunc sumAggregations

a merge function used to merge aggregation values across result sets


a list of merged aggregations

Function defined in packages/search/src/util/aggregations/merge-aggregations.ts:53