git.iko.soy/typeable/bloodhound
on master help sign in
Add Missing Aggregation support
commit1c4d40364d65c04954cca39932c23c41266a28ca authorMHova <mho@sumall.com> dateTue 2 Feb 2016, 08:41 (11 years ago) parent2096c3b
1 file changed+8−1
src/Database/Bloodhound/Types.hs+8−1
src/Database/Bloodhound/Types.hs+8−1
@@ -237,6 +237,7 @@ module Database.Bloodhound.Types
237237 , Bucket(..)
238238 , BucketAggregation(..)
239239 , TermsAggregation(..)
240+ , MissingAggregation(..)
240241 , ValueCountAggregation(..)
241242 , FilterAggregation(..)
242243 , DateHistogramAggregation(..)
@@ -1544,8 +1545,12 @@ data Aggregation = TermsAgg TermsAggregation
15441545 | DateHistogramAgg DateHistogramAggregation
15451546 | ValueCountAgg ValueCountAggregation
15461547 | FilterAgg FilterAggregation
1547− | DateRangeAgg DateRangeAggregation deriving (Eq, Show, Generic, Typeable)
1548+ | DateRangeAgg DateRangeAggregation
1549+ | MissingAgg MissingAggregation deriving (Eq, Show, Generic, Typeable)
15481550
1551+data MissingAggregation = MissingAggregation
1552+ { maField :: Text
1553+ } deriving (Eq, Show, Generic, Typeable)
15491554
15501555data TermsAggregation = TermsAggregation { term :: Either Text Text
15511556 , termInclude :: Maybe TermInclusion
@@ -1705,6 +1710,8 @@ instance ToJSON Aggregation where
17051710 , "aggs" .= ags]
17061711 toJSON (DateRangeAgg a) = object [ "date_range" .= a
17071712 ]
1713+ toJSON (MissingAgg (MissingAggregation{..})) =
1714+ object ["missing" .= object ["field" .= maField]]
17081715
17091716instance ToJSON DateRangeAggregation where
17101717 toJSON DateRangeAggregation {..} =