Exemplo n.º 1
0
        /// <summary>
        /// Retrieves the terms aggregation just by it's name
        /// </summary>
        public static IReadOnlyCollection <KeyedBucket <string> > GetGroupBy(this AggregateDictionary aggs, string aggName)
        {
            aggs.CheckForAggregationInResult(aggName);
            var itemsTerms = aggs.Terms(aggName);

            return(itemsTerms.Buckets);
        }
Exemplo n.º 2
0
        public static AggregateDictionary GetAggregationContainingResult <T>(this AggregateDictionary aggs,
                                                                             Expression <Func <T, object> > filterRule = null)
        {
            if (filterRule == null)
            {
                return(aggs);
            }

            var filterName = filterRule.GenerateFilterName();

            aggs.CheckForAggregationInResult(filterName);
            return(aggs.Filter(filterName));
        }