git.iko.soy/typeable/bloodhound
on 3a3a530 help sign in
8 files changed+39−5
since splitsnapshots
unifiedsplit
bloodhound.cabal+1−1 src/Database/V5/Bloodhound/Client.hs+3−2 src/Database/V5/Bloodhound/Internal/Aggregation.hs+8 src/Database/V5/Bloodhound/Internal/Analysis.hs−1 src/Database/V5/Bloodhound/Internal/Client.hs+11 src/Database/V5/Bloodhound/Types.hs+1 stack-8.6.yaml+14 stack.yaml+1−1
bloodhound.cabal+1−1
@@ -66,7 +66,7 @@ library
6666 aeson >= 0.11.1,
6767 blaze-builder,
6868 bytestring >= 0.10.0 && <0.11,
69− containers >= 0.5.0.0 && <0.6,
69+ containers >= 0.5.0.0 && <0.7,
7070 exceptions,
7171 hashable,
7272 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
801801 -> MappingName -> a -> m Reply
802802putMapping (IndexName indexName) (MappingName mappingName) mapping =
803803 bindM2 put url (return body)
804− where url = joinPath [indexName, "_mapping", mappingName]
804+ where url = joinPath [indexName]
805805 -- "_mapping" and mappingName above were originally transposed
806806 -- erroneously. The correct API call is: "/INDEX/_mapping/MAPPING_NAME"
807− body = Just $ encode mapping
807+ body = Just $ encode $ object
808+ [ "mappings" .= mapping ]
808809
809810versionCtlParams :: IndexDocumentSettings -> [(Text, Maybe Text)]
810811versionCtlParams cfg =
src/Database/V5/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/V5/Bloodhound/Internal/Analysis.hs−1
@@ -6,7 +6,6 @@ module Database.V5.Bloodhound.Internal.Analysis where
66import Bloodhound.Import
77
88import qualified Data.Map.Strict as M
9−import Data.String
109import qualified Data.Text as T
1110
1211import Database.V5.Bloodhound.Internal.Newtypes
src/Database/V5/Bloodhound/Internal/Client.hs+11
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
12{-# LANGUAGE FlexibleInstances #-}
23{-# LANGUAGE GeneralizedNewtypeDeriving #-}
34{-# LANGUAGE MultiParamTypeClasses #-}
@@ -9,6 +10,11 @@ module Database.V5.Bloodhound.Internal.Client where
910
1011import Bloodhound.Import
1112
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
1218import qualified Data.Text as T
1319import qualified Data.Traversable as DT
1420import qualified Data.HashMap.Strict as HM
@@ -71,6 +77,11 @@ newtype BH m a = BH {
7177 , MonadFix
7278 , MonadThrow
7379 , MonadCatch
80+#if defined(MIN_VERSION_GLASGOW_HASKELL)
81+#if MIN_VERSION_GLASGOW_HASKELL(8,6,0,0)
82+ , MonadFail
83+#endif
84+#endif
7485 , MonadMask)
7586
7687instance MonadTrans BH where
src/Database/V5/Bloodhound/Types.hs+1
@@ -372,6 +372,7 @@ module Database.V5.Bloodhound.Types
372372 , ValueCountAggregation(..)
373373 , FilterAggregation(..)
374374 , CardinalityAggregation(..)
375+ , MaxAggregation(..)
375376 , DateHistogramAggregation(..)
376377 , DateRangeAggregation(..)
377378 , 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