@@ -1814,15 +1814,16 @@ data DateRangeResult = DateRangeResult { dateRangeKey :: Text
1814 , dateRangeAggs :: Maybe AggregationResults } deriving (Show, Eq, Generic, Typeable)
1814 , dateRangeAggs :: Maybe AggregationResults } deriving (Show, Eq, Generic, Typeable)
1816toTerms :: Text -> AggregationResults -> Maybe (Bucket TermsResult)
1816toTerms :: Text -> AggregationResults -> Maybe (Bucket TermsResult)
1817−toTerms t a = M.lookup t a >>= deserialize
1817+toTerms = toAggResult
1818− where deserialize = parseMaybe parseJSON
1820toDateHistogram :: Text -> AggregationResults -> Maybe (Bucket DateHistogramResult)
1819toDateHistogram :: Text -> AggregationResults -> Maybe (Bucket DateHistogramResult)
1821−toDateHistogram t a = M.lookup t a >>= deserialize
1820+toDateHistogram = toAggResult
1822− where deserialize = parseMaybe parseJSON
1824toMissing :: Text -> AggregationResults -> Maybe MissingResult
1822toMissing :: Text -> AggregationResults -> Maybe MissingResult
1823+toMissing = toAggResult
1825+toAggResult :: (FromJSON a) => Text -> AggregationResults -> Maybe a
1825−toMissing t a = M.lookup t a >>= deserialize
1826+toAggResult t a = M.lookup t a >>= deserialize
1826 where deserialize = parseMaybe parseJSON
1827 where deserialize = parseMaybe parseJSON
1828instance BucketAggregation TermsResult where
1829instance BucketAggregation TermsResult where