@@ -143,16 +143,25 @@ instance ToJSON Query where
143 toJSON (QueryBoolQuery boolQuery) =
143 toJSON (QueryBoolQuery boolQuery) =
144 object [ "bool" .= toJSON boolQuery ]
144 object [ "bool" .= toJSON boolQuery ]
146+ toJSON (QueryBoostingQuery boostingQuery) =
147+ object ["boosting" .= toJSON boostingQuery]
147mField :: (ToJSON a, Functor f) => T.Text -> f a -> f (T.Text, Value)
150mField :: (ToJSON a, Functor f) => T.Text -> f a -> f (T.Text, Value)
148mField field = fmap ((field .=) . toJSON)
151mField field = fmap ((field .=) . toJSON)
154+instance ToJSON BoostingQuery where
155+ toJSON (BoostingQuery positiveQuery negativeQuery negativeBoost) =
156+ object [ "positive" .= toJSON positiveQuery
157+ , "negative" .= toJSON negativeQuery
158+ , "negative_boost" .= toJSON negativeBoost ]
151instance ToJSON BoolQuery where
161instance ToJSON BoolQuery where
152 toJSON (BoolQuery mustM notM shouldM min boost disableCoord) =
162 toJSON (BoolQuery mustM notM shouldM min boost disableCoord) =
153 object filtered
163 object filtered
154− where f field = fmap ((field .=) . toJSON)
155− filtered = catMaybes
164+ where filtered = catMaybes
156 [ mField "must" mustM
165 [ mField "must" mustM
157 , mField "must_not" notM
166 , mField "must_not" notM
158 , mField "should" shouldM
167 , mField "should" shouldM