@@ -796,7 +796,7 @@ data Filter = AndFilter [Filter] Cache
796796 | IdentityFilter
797797 | BoolFilter BoolMatch
798798 | ExistsFilter FieldName -- always cached
799− | GeoBoundingBoxFilter GeoBoundingBoxConstraint GeoFilterType
799+ | GeoBoundingBoxFilter GeoBoundingBoxConstraint
800800 | GeoDistanceFilter GeoPoint Distance DistanceType OptimizeBbox Cache
801801 | GeoDistanceRangeFilter GeoPoint DistanceRange
802802 | GeoPolygonFilter FieldName [LatLon]
@@ -880,6 +880,7 @@ data GeoBoundingBoxConstraint =
880880 GeoBoundingBoxConstraint { geoBBField :: FieldName
881881 , constraintBox :: GeoBoundingBox
882882 , bbConstraintcache :: Cache
883+ , geoType :: GeoFilterType
883884 } deriving (Eq, Show)
884885
885886data GeoPoint =
@@ -949,8 +950,9 @@ instance Seminearring Filter where
949950
950951instance ToJSON Filter where
951952 toJSON (AndFilter filters cache) =
952− object ["and" .= fmap toJSON filters
953− , "_cache" .= cache]
953+ object ["and" .=
954+ object [ "filters" .= fmap toJSON filters
955+ , "_cache" .= cache]]
954956
955957 toJSON (OrFilter filters cache) =
956958 object ["or" .= fmap toJSON filters
@@ -976,9 +978,8 @@ instance ToJSON Filter where
976978 toJSON (BoolFilter boolMatch) =
977979 object ["bool" .= toJSON boolMatch]
978980
979− toJSON (GeoBoundingBoxFilter bbConstraint filterType) =
980− object ["geo_bounding_box" .= toJSON bbConstraint
981− , "type" .= toJSON filterType]
981+ toJSON (GeoBoundingBoxFilter bbConstraint) =
982+ object ["geo_bounding_box" .= toJSON bbConstraint]
982983
983984 toJSON (GeoDistanceFilter (GeoPoint (FieldName distanceGeoField) geoDistLatLon)
984985 distance distanceType optimizeBbox cache) =
@@ -1282,7 +1283,7 @@ instance ToJSON MoreLikeThisQuery where
12821283 mtf mqt stopwords mindf maxdf
12831284 minwl maxwl boostTerms boost analyzer) =
12841285 omitNulls base
1285− where base = [ "like_text" .= toJSON text
1286+ where base = [ "like_text" .= toJSON text
12861287 , "fields" .= fields
12871288 , "percent_terms_to_match" .= percent
12881289 , "min_term_freq" .= mtf
@@ -1616,9 +1617,10 @@ instance ToJSON OptimizeBbox where
16161617
16171618instance ToJSON GeoBoundingBoxConstraint where
16181619 toJSON (GeoBoundingBoxConstraint
1619− (FieldName gbbcGeoBBField) gbbcConstraintBox cache) =
1620+ (FieldName gbbcGeoBBField) gbbcConstraintBox cache type') =
16201621 object [gbbcGeoBBField .= toJSON gbbcConstraintBox
1621− , "_cache" .= cache]
1622+ , "_cache" .= cache
1623+ , "type" .= type']
16221624
16231625
16241626instance ToJSON GeoFilterType where