git.iko.soy/typeable/bloodhound
on master help sign in
2 files changed+9
since splitsnapshots
unifiedsplit
src/Database/Bloodhound/Internal/Aggregation.hs+8 src/Database/Bloodhound/Types.hs+1
src/Database/Bloodhound/Internal/Aggregation.hs+8
@@ -27,6 +27,7 @@ mkAggregations name aggregation = M.insert name aggregation emptyAggregations
2727
2828data Aggregation = TermsAgg TermsAggregation
2929 | CardinalityAgg CardinalityAggregation
30+ | MaxAgg MaxAggregation
3031 | DateHistogramAgg DateHistogramAggregation
3132 | ValueCountAgg ValueCountAggregation
3233 | FilterAgg FilterAggregation
@@ -58,6 +59,9 @@ instance ToJSON Aggregation where
5859 ]
5960 ]
6061
62+ toJSON (MaxAgg (MaxAggregation field)) =
63+ object ["max" .= omitNulls [ "field" .= field ]]
64+
6165 toJSON (DateHistogramAgg
6266 (DateHistogramAggregation field interval format
6367 preZone postZone preOffset postOffset dateHistoAggs)) =
@@ -125,6 +129,10 @@ data CardinalityAggregation = CardinalityAggregation
125129 precisionThreshold :: Maybe Int
126130 } deriving (Eq, Show)
127131
132+data MaxAggregation = MaxAggregation
133+ { maxField :: FieldName
134+ } deriving (Eq, Show)
135+
128136data DateHistogramAggregation = DateHistogramAggregation
129137 { dateField :: FieldName
130138 , dateInterval :: Interval
src/Database/Bloodhound/Types.hs+1
@@ -372,6 +372,7 @@ module Database.Bloodhound.Types
372372 , ValueCountAggregation(..)
373373 , FilterAggregation(..)
374374 , CardinalityAggregation(..)
375+ , MaxAggregation(..)
375376 , DateHistogramAggregation(..)
376377 , DateRangeAggregation(..)
377378 , DateRangeAggRange(..)