@@ -143,16 +143,25 @@ instance ToJSON Query where
143143 toJSON (QueryBoolQuery boolQuery) =
144144 object [ "bool" .= toJSON boolQuery ]
145145
146+ toJSON (QueryBoostingQuery boostingQuery) =
147+ object ["boosting" .= toJSON boostingQuery]
148+
146149
147150mField :: (ToJSON a, Functor f) => T.Text -> f a -> f (T.Text, Value)
148151mField field = fmap ((field .=) . toJSON)
149152
150153
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 ]
159+
160+
151161instance ToJSON BoolQuery where
152162 toJSON (BoolQuery mustM notM shouldM min boost disableCoord) =
153163 object filtered
154− where f field = fmap ((field .=) . toJSON)
155− filtered = catMaybes
164+ where filtered = catMaybes
156165 [ mField "must" mustM
157166 , mField "must_not" notM
158167 , mField "should" shouldM