git.iko.soy/typeable/bloodhound
on 3a3a530 help sign in
bloodhound.cabal+1−1
since splitsnapshots
unifiedsplit
@@ -66,7 +66,7 @@ library
66 aeson >= 0.11.1,
66 aeson >= 0.11.1,
67 blaze-builder,
67 blaze-builder,
68 bytestring >= 0.10.0 && <0.11,
68 bytestring >= 0.10.0 && <0.11,
69− containers >= 0.5.0.0 && <0.6,
69+ containers >= 0.5.0.0 && <0.7,
70 exceptions,
70 exceptions,
71 hashable,
71 hashable,
72 http-client >= 0.4.30 && <0.7,
72 http-client >= 0.4.30 && <0.7,
src/Database/V5/Bloodhound/Client.hs+3−2
@@ -801,10 +801,11 @@ putMapping :: (MonadBH m, ToJSON a) => IndexName
801 -> MappingName -> a -> m Reply
801 -> MappingName -> a -> m Reply
802putMapping (IndexName indexName) (MappingName mappingName) mapping =
802putMapping (IndexName indexName) (MappingName mappingName) mapping =
803 bindM2 put url (return body)
803 bindM2 put url (return body)
804− where url = joinPath [indexName, "_mapping", mappingName]
804+ where url = joinPath [indexName]
805 -- "_mapping" and mappingName above were originally transposed
805 -- "_mapping" and mappingName above were originally transposed
806 -- erroneously. The correct API call is: "/INDEX/_mapping/MAPPING_NAME"
806 -- erroneously. The correct API call is: "/INDEX/_mapping/MAPPING_NAME"
807− body = Just $ encode mapping
807+ body = Just $ encode $ object
808+ [ "mappings" .= mapping ]
808
809
809versionCtlParams :: IndexDocumentSettings -> [(Text, Maybe Text)]
810versionCtlParams :: IndexDocumentSettings -> [(Text, Maybe Text)]
810versionCtlParams cfg =
811versionCtlParams cfg =
src/Database/V5/Bloodhound/Internal/Aggregation.hs+8
@@ -27,6 +27,7 @@ mkAggregations name aggregation = M.insert name aggregation emptyAggregations
27
27
28data Aggregation = TermsAgg TermsAggregation
28data Aggregation = TermsAgg TermsAggregation
29 | CardinalityAgg CardinalityAggregation
29 | CardinalityAgg CardinalityAggregation
30+ | MaxAgg MaxAggregation
30 | DateHistogramAgg DateHistogramAggregation
31 | DateHistogramAgg DateHistogramAggregation
31 | ValueCountAgg ValueCountAggregation
32 | ValueCountAgg ValueCountAggregation
32 | FilterAgg FilterAggregation
33 | FilterAgg FilterAggregation
@@ -58,6 +59,9 @@ instance ToJSON Aggregation where
58 ]
59 ]
59 ]
60 ]
60
61
62+ toJSON (MaxAgg (MaxAggregation field)) =
63+ object ["max" .= omitNulls [ "field" .= field ]]
64+
61 toJSON (DateHistogramAgg
65 toJSON (DateHistogramAgg
62 (DateHistogramAggregation field interval format
66 (DateHistogramAggregation field interval format
63 preZone postZone preOffset postOffset dateHistoAggs)) =
67 preZone postZone preOffset postOffset dateHistoAggs)) =
@@ -125,6 +129,10 @@ data CardinalityAggregation = CardinalityAggregation
125 precisionThreshold :: Maybe Int
129 precisionThreshold :: Maybe Int
126 } deriving (Eq, Show)
130 } deriving (Eq, Show)
127
131
132+data MaxAggregation = MaxAggregation
133+ { maxField :: FieldName
134+ } deriving (Eq, Show)
135+
128data DateHistogramAggregation = DateHistogramAggregation
136data DateHistogramAggregation = DateHistogramAggregation
129 { dateField :: FieldName
137 { dateField :: FieldName
130 , dateInterval :: Interval
138 , dateInterval :: Interval
src/Database/V5/Bloodhound/Internal/Analysis.hs−1
@@ -6,7 +6,6 @@ module Database.V5.Bloodhound.Internal.Analysis where
6import Bloodhound.Import
6import Bloodhound.Import
7
7
8import qualified Data.Map.Strict as M
8import qualified Data.Map.Strict as M
9−import Data.String
10import qualified Data.Text as T
9import qualified Data.Text as T
11
10
12import Database.V5.Bloodhound.Internal.Newtypes
11import Database.V5.Bloodhound.Internal.Newtypes
src/Database/V5/Bloodhound/Internal/Client.hs+11
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
1{-# LANGUAGE FlexibleInstances #-}
2{-# LANGUAGE FlexibleInstances #-}
2{-# LANGUAGE GeneralizedNewtypeDeriving #-}
3{-# LANGUAGE GeneralizedNewtypeDeriving #-}
3{-# LANGUAGE MultiParamTypeClasses #-}
4{-# LANGUAGE MultiParamTypeClasses #-}
@@ -9,6 +10,11 @@ module Database.V5.Bloodhound.Internal.Client where
9
10
10import Bloodhound.Import
11import Bloodhound.Import
11
12
13+#if defined(MIN_VERSION_GLASGOW_HASKELL)
14+#if MIN_VERSION_GLASGOW_HASKELL(8,6,0,0)
15+import Control.Monad.Fail (MonadFail)
16+#endif
17+#endif
12import qualified Data.Text as T
18import qualified Data.Text as T
13import qualified Data.Traversable as DT
19import qualified Data.Traversable as DT
14import qualified Data.HashMap.Strict as HM
20import qualified Data.HashMap.Strict as HM
@@ -71,6 +77,11 @@ newtype BH m a = BH {
71 , MonadFix
77 , MonadFix
72 , MonadThrow
78 , MonadThrow
73 , MonadCatch
79 , MonadCatch
80+#if defined(MIN_VERSION_GLASGOW_HASKELL)
81+#if MIN_VERSION_GLASGOW_HASKELL(8,6,0,0)
82+ , MonadFail
83+#endif
84+#endif
74 , MonadMask)
85 , MonadMask)
75
86
76instance MonadTrans BH where
87instance MonadTrans BH where
src/Database/V5/Bloodhound/Types.hs+1
@@ -372,6 +372,7 @@ module Database.V5.Bloodhound.Types
372 , ValueCountAggregation(..)
372 , ValueCountAggregation(..)
373 , FilterAggregation(..)
373 , FilterAggregation(..)
374 , CardinalityAggregation(..)
374 , CardinalityAggregation(..)
375+ , MaxAggregation(..)
375 , DateHistogramAggregation(..)
376 , DateHistogramAggregation(..)
376 , DateRangeAggregation(..)
377 , DateRangeAggregation(..)
377 , DateRangeAggRange(..)
378 , DateRangeAggRange(..)
stack-8.6.yamlnew file+14
@@ -0,0 +1,14 @@
1+flags:
2+ bloodhound-examples:
3+ werror: true
4+
5+packages:
6+ - '.'
7+ - './examples'
8+
9+extra-deps:
10+ - git: https://github.com/bitemyapp/quickcheck-arbitrary-template.git
11+ commit: bf9cee96a88ecce2ff920ce74c166a38712e5ed2
12+ - quickcheck-properties-0.1
13+
14+resolver: lts-13.21
stack.yaml+1−1
@@ -1 +1 @@
1−stack-8.2.yaml
1+stack-8.6.yaml