@@ -59,12 +59,12 @@ instance ToJSON Filter where
5959 , distanceGeoField .= toJSON latLon
6060 , "_cache" .= cache]]
6161
62− toJSON (GeoDistanceRangeFilter (GeoPoint (FieldName geoField) drLatLon)
63− (DistanceRange distanceFrom distanceTo)) =
62+ toJSON (GeoDistanceRangeFilter (GeoPoint (FieldName gddrField) drLatLon)
63+ (DistanceRange distanceFrom drDistanceTo)) =
6464 object ["geo_distance_range" .=
6565 object ["from" .= toJSON distanceFrom
66− , "to" .= toJSON distanceTo
67− , geoField .= toJSON drLatLon]]
66+ , "to" .= toJSON drDistanceTo
67+ , gddrField .= toJSON drLatLon]]
6868
6969 toJSON (GeoPolygonFilter (FieldName geoField) latLons) =
7070 object ["geo_polygon" .=
@@ -358,20 +358,20 @@ instance ToJSON CommonMinimumMatch where
358358 , "high_freq" .= toJSON highF ]
359359
360360instance ToJSON BoostingQuery where
361− toJSON (BoostingQuery positiveQuery negativeQuery negativeBoost) =
362− object [ "positive" .= toJSON positiveQuery
363− , "negative" .= toJSON negativeQuery
364− , "negative_boost" .= toJSON negativeBoost ]
361+ toJSON (BoostingQuery bqPositiveQuery bqNegativeQuery bqNegativeBoost) =
362+ object [ "positive" .= toJSON bqPositiveQuery
363+ , "negative" .= toJSON bqNegativeQuery
364+ , "negative_boost" .= toJSON bqNegativeBoost ]
365365
366366
367367instance ToJSON BoolQuery where
368− toJSON (BoolQuery mustM notM shouldM min boost disableCoord) =
368+ toJSON (BoolQuery mustM notM shouldM bqMin boost disableCoord) =
369369 object filtered
370370 where filtered = catMaybes
371371 [ mField "must" mustM
372372 , mField "must_not" notM
373373 , mField "should" shouldM
374− , mField "minimum_should_match" min
374+ , mField "minimum_should_match" bqMin
375375 , mField "boost" boost
376376 , mField "disable_coord" disableCoord ]
377377
@@ -491,14 +491,14 @@ instance (FromJSON a) => FromJSON (EsResult a) where
491491
492492
493493instance ToJSON Search where
494− toJSON (Search query filter sort trackSortScores from size) =
494+ toJSON (Search query filter sort sTrackSortScores sFrom sSize) =
495495 object merged where
496496 lQuery = maybeJson "query" query
497497 lFilter = maybeJson "filter" filter
498498 lSort = maybeJsonF "sort" sort
499− merged = mconcat [[ "from" .= from
500− , "size" .= size
501− , "track_scores" .= trackSortScores]
499+ merged = mconcat [[ "from" .= sFrom
500+ , "size" .= sSize
501+ , "track_scores" .= sTrackSortScores]
502502 , lQuery
503503 , lFilter
504504 , lSort]
@@ -506,20 +506,20 @@ instance ToJSON Search where
506506
507507instance ToJSON SortSpec where
508508 toJSON (DefaultSortSpec
509− (DefaultSort (FieldName sortFieldName) sortOrder ignoreUnmapped
510− sortMode missingSort nestedFilter)) =
511− object [sortFieldName .= object merged] where
512− base = ["order" .= toJSON sortOrder
513− , "ignore_unmapped" .= ignoreUnmapped]
514− lSortMode = maybeJson "mode" sortMode
515− lMissingSort = maybeJson "missing" missingSort
516− lNestedFilter = maybeJson "nested_filter" nestedFilter
509+ (DefaultSort (FieldName dsSortFieldName) dsSortOrder dsIgnoreUnmapped
510+ dsSortMode dsMissingSort dsNestedFilter)) =
511+ object [dsSortFieldName .= object merged] where
512+ base = ["order" .= toJSON dsSortOrder
513+ , "ignore_unmapped" .= dsIgnoreUnmapped]
514+ lSortMode = maybeJson "mode" dsSortMode
515+ lMissingSort = maybeJson "missing" dsMissingSort
516+ lNestedFilter = maybeJson "nested_filter" dsNestedFilter
517517 merged = mconcat [base, lSortMode, lMissingSort, lNestedFilter]
518518
519− toJSON (GeoDistanceSortSpec sortOrder (GeoPoint (FieldName field) latLon) units) =
519+ toJSON (GeoDistanceSortSpec gdsSortOrder (GeoPoint (FieldName field) gdsLatLon) units) =
520520 object [ "unit" .= toJSON units
521− , field .= toJSON latLon
522− , "order" .= toJSON sortOrder ]
521+ , field .= toJSON gdsLatLon
522+ , "order" .= toJSON gdsSortOrder ]
523523
524524
525525instance ToJSON SortOrder where
@@ -548,10 +548,10 @@ instance ToJSON ScoreType where
548548
549549
550550instance ToJSON Distance where
551− toJSON (Distance coefficient unit) =
551+ toJSON (Distance dCoefficient dUnit) =
552552 String boltedTogether where
553− coefText = showText coefficient
554− (String unitText) = (toJSON unit)
553+ coefText = showText dCoefficient
554+ (String unitText) = toJSON dUnit
555555 boltedTogether = mappend coefText unitText
556556
557557
@@ -579,8 +579,9 @@ instance ToJSON OptimizeBbox where
579579
580580
581581instance ToJSON GeoBoundingBoxConstraint where
582− toJSON (GeoBoundingBoxConstraint (FieldName geoBBField) constraintBox cache) =
583− object [geoBBField .= toJSON constraintBox
582+ toJSON (GeoBoundingBoxConstraint
583+ (FieldName gbbcGeoBBField) gbbcConstraintBox cache) =
584+ object [gbbcGeoBBField .= toJSON gbbcConstraintBox
584585 , "_cache" .= cache]
585586
586587
@@ -590,15 +591,15 @@ instance ToJSON GeoFilterType where
590591
591592
592593instance ToJSON GeoBoundingBox where
593− toJSON (GeoBoundingBox topLeft bottomRight) =
594− object ["top_left" .= toJSON topLeft
595− , "bottom_right" .= toJSON bottomRight]
594+ toJSON (GeoBoundingBox gbbTopLeft gbbBottomRight) =
595+ object ["top_left" .= toJSON gbbTopLeft
596+ , "bottom_right" .= toJSON gbbBottomRight]
596597
597598
598599instance ToJSON LatLon where
599− toJSON (LatLon lat lon) =
600− object ["lat" .= lat
601− , "lon" .= lon]
600+ toJSON (LatLon lLat lLon) =
601+ object ["lat" .= lLat
602+ , "lon" .= lLon]
602603
603604
604605-- index for smaller ranges, fielddata for longer ranges