@@ -457,22 +457,22 @@ newtype ReplicaCount = ReplicaCount Int deriving (Eq, Show, Generic)
458{-| 'Server' is used with the client functions to point at the ES instance
458{-| 'Server' is used with the client functions to point at the ES instance
460−newtype Server = Server String deriving (Eq, Show)
460+newtype Server = Server Text deriving (Eq, Show)
462{-| 'IndexName' is used to describe which index to query/create/delete
462{-| 'IndexName' is used to describe which index to query/create/delete
464−newtype IndexName = IndexName String deriving (Eq, Generic, Show)
464+newtype IndexName = IndexName Text deriving (Eq, Generic, Show)
466{-| 'MappingName' is part of mappings which are how ES describes and schematizes
466{-| 'MappingName' is part of mappings which are how ES describes and schematizes
467 the data in the indices.
467 the data in the indices.
469−newtype MappingName = MappingName String deriving (Eq, Generic, Show)
469+newtype MappingName = MappingName Text deriving (Eq, Generic, Show)
471{-| 'DocId' is a generic wrapper value for expressing unique Document IDs.
471{-| 'DocId' is a generic wrapper value for expressing unique Document IDs.
472 Can be set by the user or created by ES itself. Often used in client
472 Can be set by the user or created by ES itself. Often used in client
473 functions for poking at specific documents.
473 functions for poking at specific documents.
475−newtype DocId = DocId String deriving (Eq, Generic, Show)
475+newtype DocId = DocId Text deriving (Eq, Generic, Show)
477{-| 'QueryString' is used to wrap query text bodies, be they human written or not.
477{-| 'QueryString' is used to wrap query text bodies, be they human written or not.
@@ -583,7 +583,7 @@ newtype MaxDocFrequency = MaxDocFrequency Int deriving (Eq, Show, Generic)
584{-| 'unpackId' is a silly convenience function that gets used once.
584{-| 'unpackId' is a silly convenience function that gets used once.
586−unpackId :: DocId -> String
586+unpackId :: DocId -> Text
587unpackId (DocId docId) = docId
587unpackId (DocId docId) = docId
589type TrackSortScores = Bool
589type TrackSortScores = Bool
@@ -1252,29 +1252,29 @@ instance Show TimeInterval where
1252instance ToJSON Aggregation where
1252instance ToJSON Aggregation where
1253 toJSON (TermsAgg (TermsAggregation term include exclude order minDocCount size shardSize collectMode executionHint termAggs)) =
1253 toJSON (TermsAgg (TermsAggregation term include exclude order minDocCount size shardSize collectMode executionHint termAggs)) =
1254 omitNulls ["terms" .= omitNulls [ toJSON' term,
1254 omitNulls ["terms" .= omitNulls [ toJSON' term,
1255− "include" .= toJSON include,
1255+ "include" .= include,
1256− "exclude" .= toJSON exclude,
1256+ "exclude" .= exclude,
1257− "order" .= toJSON order,
1257+ "order" .= order,
1258− "min_doc_count" .= toJSON minDocCount,
1258+ "min_doc_count" .= minDocCount,
1259− "size" .= toJSON size,
1259+ "size" .= size,
1260− "shard_size" .= toJSON shardSize,
1260+ "shard_size" .= shardSize,
1261− "collect_mode" .= toJSON collectMode,
1261+ "collect_mode" .= collectMode,
1262− "execution_hint" .= toJSON executionHint
1262+ "execution_hint" .= executionHint
1264− "aggs" .= toJSON termAggs ]
1264+ "aggs" .= termAggs ]
1266− toJSON' x = case x of { Left y -> "field" .= toJSON y; Right y -> "script" .= toJSON y }
1266+ toJSON' x = case x of { Left y -> "field" .= y; Right y -> "script" .= y }
1268 toJSON (DateHistogramAgg (DateHistogramAggregation field interval format preZone postZone preOffset postOffset dateHistoAggs)) =
1268 toJSON (DateHistogramAgg (DateHistogramAggregation field interval format preZone postZone preOffset postOffset dateHistoAggs)) =
1269− omitNulls ["date_histogram" .= omitNulls [ "field" .= toJSON field,
1269+ omitNulls ["date_histogram" .= omitNulls [ "field" .= field,
1270− "interval" .= toJSON interval,
1270+ "interval" .= interval,
1271− "format" .= toJSON format,
1271+ "format" .= format,
1272− "pre_zone" .= toJSON preZone,
1272+ "pre_zone" .= preZone,
1273− "post_zone" .= toJSON postZone,
1273+ "post_zone" .= postZone,
1274− "pre_offset" .= toJSON preOffset,
1274+ "pre_offset" .= preOffset,
1275− "post_offset" .= toJSON postOffset
1275+ "post_offset" .= postOffset
1277− "aggs" .= toJSON dateHistoAggs ]
1277+ "aggs" .= dateHistoAggs ]
1279type AggregationResults = M.Map Text Value
1279type AggregationResults = M.Map Text Value
@@ -1352,7 +1352,7 @@ instance ToJSON Filter where
1353 toJSON (NotFilter notFilter cache) =
1353 toJSON (NotFilter notFilter cache) =
1354 object ["not" .=
1354 object ["not" .=
1355− object ["filter" .= toJSON notFilter
1355+ object ["filter" .= notFilter
1356 , "_cache" .= cache]]
1356 , "_cache" .= cache]]
1358 toJSON (IdentityFilter) =
1358 toJSON (IdentityFilter) =
@@ -1368,26 +1368,26 @@ instance ToJSON Filter where
1368 ["field" .= fieldName]]
1368 ["field" .= fieldName]]
1370 toJSON (BoolFilter boolMatch) =
1370 toJSON (BoolFilter boolMatch) =
1371− object ["bool" .= toJSON boolMatch]
1371+ object ["bool" .= boolMatch]
1373 toJSON (GeoBoundingBoxFilter bbConstraint) =
1373 toJSON (GeoBoundingBoxFilter bbConstraint) =
1374− object ["geo_bounding_box" .= toJSON bbConstraint]
1374+ object ["geo_bounding_box" .= bbConstraint]
1376 toJSON (GeoDistanceFilter (GeoPoint (FieldName distanceGeoField) geoDistLatLon)
1376 toJSON (GeoDistanceFilter (GeoPoint (FieldName distanceGeoField) geoDistLatLon)
1377 distance distanceType optimizeBbox cache) =
1377 distance distanceType optimizeBbox cache) =
1378 object ["geo_distance" .=
1378 object ["geo_distance" .=
1379− object ["distance" .= toJSON distance
1379+ object ["distance" .= distance
1380− , "distance_type" .= toJSON distanceType
1380+ , "distance_type" .= distanceType
1381 , "optimize_bbox" .= optimizeBbox
1381 , "optimize_bbox" .= optimizeBbox
1382− , distanceGeoField .= toJSON geoDistLatLon
1382+ , distanceGeoField .= geoDistLatLon
1383 , "_cache" .= cache]]
1383 , "_cache" .= cache]]
1385 toJSON (GeoDistanceRangeFilter (GeoPoint (FieldName gddrField) drLatLon)
1385 toJSON (GeoDistanceRangeFilter (GeoPoint (FieldName gddrField) drLatLon)
1386 (DistanceRange geoDistRangeDistFrom drDistanceTo)) =
1386 (DistanceRange geoDistRangeDistFrom drDistanceTo)) =
1387 object ["geo_distance_range" .=
1387 object ["geo_distance_range" .=
1388− object ["from" .= toJSON geoDistRangeDistFrom
1388+ object ["from" .= geoDistRangeDistFrom
1389− , "to" .= toJSON drDistanceTo
1389+ , "to" .= drDistanceTo
1390− , gddrField .= toJSON drLatLon]]
1390+ , gddrField .= drLatLon]]
1392 toJSON (GeoPolygonFilter (FieldName geoPolygonFilterField) latLons) =
1392 toJSON (GeoPolygonFilter (FieldName geoPolygonFilterField) latLons) =
1393 object ["geo_polygon" .=
1393 object ["geo_polygon" .=
@@ -1397,7 +1397,7 @@ instance ToJSON Filter where
1397 toJSON (IdsFilter (MappingName mappingName) values) =
1397 toJSON (IdsFilter (MappingName mappingName) values) =
1398 object ["ids" .=
1398 object ["ids" .=
1399 object ["type" .= mappingName
1399 object ["type" .= mappingName
1400− , "values" .= fmap (T.pack . unpackId) values]]
1400+ , "values" .= fmap unpackId values]]
1402 toJSON (LimitFilter limit) =
1402 toJSON (LimitFilter limit) =
1403 object ["limit" .= object ["value" .= limit]]
1403 object ["limit" .= object ["value" .= limit]]
@@ -1416,7 +1416,7 @@ instance ToJSON Filter where
1416 toJSON (RangeFilter (FieldName fieldName) rangeValue rangeExecution cache) =
1416 toJSON (RangeFilter (FieldName fieldName) rangeValue rangeExecution cache) =
1417 object ["range" .=
1417 object ["range" .=
1418 object [ fieldName .= object (rangeValueToPair rangeValue)
1418 object [ fieldName .= object (rangeValueToPair rangeValue)
1419− , "execution" .= toJSON rangeExecution
1419+ , "execution" .= rangeExecution
1420 , "_cache" .= cache]]
1420 , "_cache" .= cache]]
1422 toJSON (RegexpFilter (FieldName fieldName)
1422 toJSON (RegexpFilter (FieldName fieldName)
@@ -1424,14 +1424,14 @@ instance ToJSON Filter where
1424 object ["regexp" .=
1424 object ["regexp" .=
1425 object [fieldName .=
1425 object [fieldName .=
1426 object ["value" .= regexText
1426 object ["value" .= regexText
1427− , "flags" .= toJSON flags]
1427+ , "flags" .= flags]
1428 , "_name" .= cacheName
1428 , "_name" .= cacheName
1429 , "_cache" .= cache
1429 , "_cache" .= cache
1430 , "_cache_key" .= cacheKey]]
1430 , "_cache_key" .= cacheKey]]
1432instance ToJSON GeoPoint where
1432instance ToJSON GeoPoint where
1433 toJSON (GeoPoint (FieldName geoPointField) geoPointLatLon) =
1433 toJSON (GeoPoint (FieldName geoPointField) geoPointLatLon) =
1434− object [ geoPointField .= toJSON geoPointLatLon ]
1434+ object [ geoPointField .= geoPointLatLon ]
1437instance ToJSON Query where
1437instance ToJSON Query where
@@ -1451,82 +1451,82 @@ instance ToJSON Query where
1451 getTermValue (Term _ v) = v
1451 getTermValue (Term _ v) = v
1452 toJSON (IdsQuery idsQueryMappingName docIds) =
1452 toJSON (IdsQuery idsQueryMappingName docIds) =
1453 object [ "ids" .= object conjoined ]
1453 object [ "ids" .= object conjoined ]
1454− where conjoined = [ "type" .= toJSON idsQueryMappingName
1454+ where conjoined = [ "type" .= idsQueryMappingName
1455 , "values" .= fmap toJSON docIds ]
1455 , "values" .= fmap toJSON docIds ]
1457 toJSON (QueryQueryStringQuery qQueryStringQuery) =
1457 toJSON (QueryQueryStringQuery qQueryStringQuery) =
1458− object [ "query_string" .= toJSON qQueryStringQuery ]
1458+ object [ "query_string" .= qQueryStringQuery ]
1460 toJSON (QueryMatchQuery matchQuery) =
1460 toJSON (QueryMatchQuery matchQuery) =
1461− object [ "match" .= toJSON matchQuery ]
1461+ object [ "match" .= matchQuery ]
1463 toJSON (QueryMultiMatchQuery multiMatchQuery) =
1463 toJSON (QueryMultiMatchQuery multiMatchQuery) =
1464 toJSON multiMatchQuery
1464 toJSON multiMatchQuery
1466 toJSON (QueryBoolQuery boolQuery) =
1466 toJSON (QueryBoolQuery boolQuery) =
1467− object [ "bool" .= toJSON boolQuery ]
1467+ object [ "bool" .= boolQuery ]
1469 toJSON (QueryBoostingQuery boostingQuery) =
1469 toJSON (QueryBoostingQuery boostingQuery) =
1470− object [ "boosting" .= toJSON boostingQuery ]
1470+ object [ "boosting" .= boostingQuery ]
1472 toJSON (QueryCommonTermsQuery commonTermsQuery) =
1472 toJSON (QueryCommonTermsQuery commonTermsQuery) =
1473− object [ "common" .= toJSON commonTermsQuery ]
1473+ object [ "common" .= commonTermsQuery ]
1475 toJSON (ConstantScoreFilter csFilter boost) =
1475 toJSON (ConstantScoreFilter csFilter boost) =
1476− object [ "constant_score" .= toJSON csFilter
1476+ object [ "constant_score" .= csFilter
1477− , "boost" .= toJSON boost]
1477+ , "boost" .= boost]
1479 toJSON (ConstantScoreQuery query boost) =
1479 toJSON (ConstantScoreQuery query boost) =
1480− object [ "constant_score" .= toJSON query
1480+ object [ "constant_score" .= query
1481− , "boost" .= toJSON boost]
1481+ , "boost" .= boost]
1483 toJSON (QueryDisMaxQuery disMaxQuery) =
1483 toJSON (QueryDisMaxQuery disMaxQuery) =
1484− object [ "dis_max" .= toJSON disMaxQuery ]
1484+ object [ "dis_max" .= disMaxQuery ]
1486 toJSON (QueryFilteredQuery qFilteredQuery) =
1486 toJSON (QueryFilteredQuery qFilteredQuery) =
1487− object [ "filtered" .= toJSON qFilteredQuery ]
1487+ object [ "filtered" .= qFilteredQuery ]
1489 toJSON (QueryFuzzyLikeThisQuery fuzzyQuery) =
1489 toJSON (QueryFuzzyLikeThisQuery fuzzyQuery) =
1490− object [ "fuzzy_like_this" .= toJSON fuzzyQuery ]
1490+ object [ "fuzzy_like_this" .= fuzzyQuery ]
1492 toJSON (QueryFuzzyLikeFieldQuery fuzzyFieldQuery) =
1492 toJSON (QueryFuzzyLikeFieldQuery fuzzyFieldQuery) =
1493− object [ "fuzzy_like_this_field" .= toJSON fuzzyFieldQuery ]
1493+ object [ "fuzzy_like_this_field" .= fuzzyFieldQuery ]
1495 toJSON (QueryFuzzyQuery fuzzyQuery) =
1495 toJSON (QueryFuzzyQuery fuzzyQuery) =
1496− object [ "fuzzy" .= toJSON fuzzyQuery ]
1496+ object [ "fuzzy" .= fuzzyQuery ]
1498 toJSON (QueryHasChildQuery childQuery) =
1498 toJSON (QueryHasChildQuery childQuery) =
1499− object [ "has_child" .= toJSON childQuery ]
1499+ object [ "has_child" .= childQuery ]
1501 toJSON (QueryHasParentQuery parentQuery) =
1501 toJSON (QueryHasParentQuery parentQuery) =
1502− object [ "has_parent" .= toJSON parentQuery ]
1502+ object [ "has_parent" .= parentQuery ]
1504 toJSON (QueryIndicesQuery qIndicesQuery) =
1504 toJSON (QueryIndicesQuery qIndicesQuery) =
1505− object [ "indices" .= toJSON qIndicesQuery ]
1505+ object [ "indices" .= qIndicesQuery ]
1507 toJSON (MatchAllQuery boost) =
1507 toJSON (MatchAllQuery boost) =
1508 object [ "match_all" .= omitNulls [ "boost" .= boost ] ]
1508 object [ "match_all" .= omitNulls [ "boost" .= boost ] ]
1510 toJSON (QueryMoreLikeThisQuery query) =
1510 toJSON (QueryMoreLikeThisQuery query) =
1511− object [ "more_like_this" .= toJSON query ]
1511+ object [ "more_like_this" .= query ]
1513 toJSON (QueryMoreLikeThisFieldQuery query) =
1513 toJSON (QueryMoreLikeThisFieldQuery query) =
1514− object [ "more_like_this_field" .= toJSON query ]
1514+ object [ "more_like_this_field" .= query ]
1516 toJSON (QueryNestedQuery query) =
1516 toJSON (QueryNestedQuery query) =
1517− object [ "nested" .= toJSON query ]
1517+ object [ "nested" .= query ]
1519 toJSON (QueryPrefixQuery query) =
1519 toJSON (QueryPrefixQuery query) =
1520− object [ "prefix" .= toJSON query ]
1520+ object [ "prefix" .= query ]
1522 toJSON (QueryRangeQuery query) =
1522 toJSON (QueryRangeQuery query) =
1523− object [ "range" .= toJSON query ]
1523+ object [ "range" .= query ]
1525 toJSON (QueryRegexpQuery query) =
1525 toJSON (QueryRegexpQuery query) =
1526− object [ "regexp" .= toJSON query ]
1526+ object [ "regexp" .= query ]
1528 toJSON (QuerySimpleQueryStringQuery query) =
1528 toJSON (QuerySimpleQueryStringQuery query) =
1529− object [ "simple_query_string" .= toJSON query ]
1529+ object [ "simple_query_string" .= query ]
1532omitNulls :: [(Text, Value)] -> Value
1532omitNulls :: [(Text, Value)] -> Value
@@ -1539,7 +1539,7 @@ omitNulls = object . filter notNull where
1539instance ToJSON SimpleQueryStringQuery where
1539instance ToJSON SimpleQueryStringQuery where
1540 toJSON SimpleQueryStringQuery {..} =
1540 toJSON SimpleQueryStringQuery {..} =
1541 omitNulls (base ++ maybeAdd)
1541 omitNulls (base ++ maybeAdd)
1542− where base = [ "query" .= toJSON simpleQueryStringQuery ]
1542+ where base = [ "query" .= simpleQueryStringQuery ]
1543 maybeAdd = [ "fields" .= simpleQueryStringField
1543 maybeAdd = [ "fields" .= simpleQueryStringField
1544 , "default_operator" .= simpleQueryStringOperator
1544 , "default_operator" .= simpleQueryStringOperator
1545 , "analyzer" .= simpleQueryStringAnalyzer
1545 , "analyzer" .= simpleQueryStringAnalyzer
@@ -1575,7 +1575,7 @@ instance ToJSON RegexpQuery where
1575 rqQueryBoost) =
1575 rqQueryBoost) =
1576 object [ rqQueryField .= omitNulls base ]
1576 object [ rqQueryField .= omitNulls base ]
1577 where base = [ "value" .= regexpQueryQuery
1577 where base = [ "value" .= regexpQueryQuery
1578− , "flags" .= toJSON rqQueryFlags
1578+ , "flags" .= rqQueryFlags
1579 , "boost" .= rqQueryBoost ]
1579 , "boost" .= rqQueryBoost ]
@@ -1591,7 +1591,7 @@ instance ToJSON QueryStringQuery where
1591 qsLenient qsLocale) =
1591 qsLenient qsLocale) =
1592 omitNulls base
1592 omitNulls base
1594− base = [ "query" .= toJSON qsQueryString
1594+ base = [ "query" .= qsQueryString
1595 , "default_field" .= qsDefaultField
1595 , "default_field" .= qsDefaultField
1596 , "default_operator" .= qsOperator
1596 , "default_operator" .= qsOperator
1597 , "analyzer" .= qsAnalyzer
1597 , "analyzer" .= qsAnalyzer
@@ -1613,21 +1613,21 @@ instance ToJSON QueryStringQuery where
1613instance ToJSON RangeQuery where
1613instance ToJSON RangeQuery where
1614 toJSON (RangeQuery (FieldName fieldName) range boost) =
1614 toJSON (RangeQuery (FieldName fieldName) range boost) =
1615 object [ fieldName .= conjoined ]
1615 object [ fieldName .= conjoined ]
1616− where conjoined = [ "boost" .= toJSON boost ] ++ (rangeValueToPair range)
1616+ where conjoined = [ "boost" .= boost ] ++ (rangeValueToPair range)
1619instance ToJSON PrefixQuery where
1619instance ToJSON PrefixQuery where
1620 toJSON (PrefixQuery (FieldName fieldName) queryValue boost) =
1620 toJSON (PrefixQuery (FieldName fieldName) queryValue boost) =
1621 object [ fieldName .= omitNulls base ]
1621 object [ fieldName .= omitNulls base ]
1622− where base = [ "value" .= toJSON queryValue
1622+ where base = [ "value" .= queryValue
1623 , "boost" .= boost ]
1623 , "boost" .= boost ]
1626instance ToJSON NestedQuery where
1626instance ToJSON NestedQuery where
1627 toJSON (NestedQuery nqPath nqScoreType nqQuery) =
1627 toJSON (NestedQuery nqPath nqScoreType nqQuery) =
1628− object [ "path" .= toJSON nqPath
1628+ object [ "path" .= nqPath
1629− , "score_mode" .= toJSON nqScoreType
1629+ , "score_mode" .= nqScoreType
1630− , "query" .= toJSON nqQuery ]
1630+ , "query" .= nqQuery ]
1633instance ToJSON MoreLikeThisFieldQuery where
1633instance ToJSON MoreLikeThisFieldQuery where
@@ -1635,7 +1635,7 @@ instance ToJSON MoreLikeThisFieldQuery where
1635 percent mtf mqt stopwords mindf maxdf
1635 percent mtf mqt stopwords mindf maxdf
1636 minwl maxwl boostTerms boost analyzer) =
1636 minwl maxwl boostTerms boost analyzer) =
1637 object [ fieldName .= omitNulls base ]
1637 object [ fieldName .= omitNulls base ]
1638− where base = [ "like_text" .= toJSON text
1638+ where base = [ "like_text" .= text
1639 , "percent_terms_to_match" .= percent
1639 , "percent_terms_to_match" .= percent
1640 , "min_term_freq" .= mtf
1640 , "min_term_freq" .= mtf
1641 , "max_query_terms" .= mqt
1641 , "max_query_terms" .= mqt
@@ -1654,7 +1654,7 @@ instance ToJSON MoreLikeThisQuery where
1654 mtf mqt stopwords mindf maxdf
1654 mtf mqt stopwords mindf maxdf
1655 minwl maxwl boostTerms boost analyzer) =
1655 minwl maxwl boostTerms boost analyzer) =
1656 omitNulls base
1656 omitNulls base
1657− where base = [ "like_text" .= toJSON text
1657+ where base = [ "like_text" .= text
1658 , "fields" .= fields
1658 , "fields" .= fields
1659 , "percent_terms_to_match" .= percent
1659 , "percent_terms_to_match" .= percent
1660 , "min_term_freq" .= mtf
1660 , "min_term_freq" .= mtf
@@ -1671,34 +1671,34 @@ instance ToJSON MoreLikeThisQuery where
1672instance ToJSON IndicesQuery where
1672instance ToJSON IndicesQuery where
1673 toJSON (IndicesQuery indices query noMatch) =
1673 toJSON (IndicesQuery indices query noMatch) =
1674− omitNulls [ "indices" .= toJSON indices
1674+ omitNulls [ "indices" .= indices
1675− , "no_match_query" .= toJSON noMatch
1675+ , "no_match_query" .= noMatch
1676− , "query" .= toJSON query ]
1676+ , "query" .= query ]
1679instance ToJSON HasParentQuery where
1679instance ToJSON HasParentQuery where
1680 toJSON (HasParentQuery queryType query scoreType) =
1680 toJSON (HasParentQuery queryType query scoreType) =
1681− omitNulls [ "parent_type" .= toJSON queryType
1681+ omitNulls [ "parent_type" .= queryType
1682− , "score_type" .= toJSON scoreType
1682+ , "score_type" .= scoreType
1683− , "query" .= toJSON query ]
1683+ , "query" .= query ]
1686instance ToJSON HasChildQuery where
1686instance ToJSON HasChildQuery where
1687 toJSON (HasChildQuery queryType query scoreType) =
1687 toJSON (HasChildQuery queryType query scoreType) =
1688− omitNulls [ "query" .= toJSON query
1688+ omitNulls [ "query" .= query
1689− , "score_type" .= toJSON scoreType
1689+ , "score_type" .= scoreType
1690− , "type" .= toJSON queryType ]
1690+ , "type" .= queryType ]
1693instance ToJSON FuzzyQuery where
1693instance ToJSON FuzzyQuery where
1694 toJSON (FuzzyQuery (FieldName fieldName) queryText
1694 toJSON (FuzzyQuery (FieldName fieldName) queryText
1695 prefixLength maxEx fuzziness boost) =
1695 prefixLength maxEx fuzziness boost) =
1696 object [ fieldName .= omitNulls base ]
1696 object [ fieldName .= omitNulls base ]
1697− where base = [ "value" .= toJSON queryText
1697+ where base = [ "value" .= queryText
1698− , "fuzziness" .= toJSON fuzziness
1698+ , "fuzziness" .= fuzziness
1699− , "prefix_length" .= toJSON prefixLength
1699+ , "prefix_length" .= prefixLength
1700− , "boost" .= toJSON boost
1700+ , "boost" .= boost
1701− , "max_expansions" .= toJSON maxEx ]
1701+ , "max_expansions" .= maxEx ]
1704instance ToJSON FuzzyLikeFieldQuery where
1704instance ToJSON FuzzyLikeFieldQuery where
@@ -1706,41 +1706,41 @@ instance ToJSON FuzzyLikeFieldQuery where
1706 fieldText maxTerms ignoreFreq fuzziness prefixLength
1706 fieldText maxTerms ignoreFreq fuzziness prefixLength
1707 boost analyzer) =
1707 boost analyzer) =
1708 object [ fieldName .=
1708 object [ fieldName .=
1709− omitNulls [ "like_text" .= toJSON fieldText
1709+ omitNulls [ "like_text" .= fieldText
1710− , "max_query_terms" .= toJSON maxTerms
1710+ , "max_query_terms" .= maxTerms
1711− , "ignore_tf" .= toJSON ignoreFreq
1711+ , "ignore_tf" .= ignoreFreq
1712− , "fuzziness" .= toJSON fuzziness
1712+ , "fuzziness" .= fuzziness
1713− , "prefix_length" .= toJSON prefixLength
1713+ , "prefix_length" .= prefixLength
1714− , "analyzer" .= toJSON analyzer
1714+ , "analyzer" .= analyzer
1715− , "boost" .= toJSON boost ]]
1715+ , "boost" .= boost ]]
1718instance ToJSON FuzzyLikeThisQuery where
1718instance ToJSON FuzzyLikeThisQuery where
1719 toJSON (FuzzyLikeThisQuery fields text maxTerms
1719 toJSON (FuzzyLikeThisQuery fields text maxTerms
1720 ignoreFreq fuzziness prefixLength boost analyzer) =
1720 ignoreFreq fuzziness prefixLength boost analyzer) =
1721 omitNulls base
1721 omitNulls base
1722− where base = [ "fields" .= toJSON fields
1722+ where base = [ "fields" .= fields
1723− , "like_text" .= toJSON text
1723+ , "like_text" .= text
1724− , "max_query_terms" .= toJSON maxTerms
1724+ , "max_query_terms" .= maxTerms
1725− , "ignore_tf" .= toJSON ignoreFreq
1725+ , "ignore_tf" .= ignoreFreq
1726− , "fuzziness" .= toJSON fuzziness
1726+ , "fuzziness" .= fuzziness
1727− , "prefix_length" .= toJSON prefixLength
1727+ , "prefix_length" .= prefixLength
1728− , "analyzer" .= toJSON analyzer
1728+ , "analyzer" .= analyzer
1729− , "boost" .= toJSON boost ]
1729+ , "boost" .= boost ]
1732instance ToJSON FilteredQuery where
1732instance ToJSON FilteredQuery where
1733 toJSON (FilteredQuery query fFilter) =
1733 toJSON (FilteredQuery query fFilter) =
1734− object [ "query" .= toJSON query
1734+ object [ "query" .= query
1735− , "filter" .= toJSON fFilter ]
1735+ , "filter" .= fFilter ]
1738instance ToJSON DisMaxQuery where
1738instance ToJSON DisMaxQuery where
1739 toJSON (DisMaxQuery queries tiebreaker boost) =
1739 toJSON (DisMaxQuery queries tiebreaker boost) =
1740 omitNulls base
1740 omitNulls base
1741− where base = [ "queries" .= toJSON queries
1741+ where base = [ "queries" .= queries
1742− , "boost" .= toJSON boost
1742+ , "boost" .= boost
1743− , "tie_breaker" .= toJSON tiebreaker ]
1743+ , "tie_breaker" .= tiebreaker ]
1746instance ToJSON CommonTermsQuery where
1746instance ToJSON CommonTermsQuery where
@@ -1748,38 +1748,38 @@ instance ToJSON CommonTermsQuery where
1748 (QueryString query) cf lfo hfo msm
1748 (QueryString query) cf lfo hfo msm
1749 boost analyzer disableCoord) =
1749 boost analyzer disableCoord) =
1750 object [fieldName .= omitNulls base ]
1750 object [fieldName .= omitNulls base ]
1751− where base = [ "query" .= toJSON query
1751+ where base = [ "query" .= query
1752− , "cutoff_frequency" .= toJSON cf
1752+ , "cutoff_frequency" .= cf
1753− , "low_freq_operator" .= toJSON lfo
1753+ , "low_freq_operator" .= lfo
1754− , "minimum_should_match" .= toJSON msm
1754+ , "minimum_should_match" .= msm
1755− , "boost" .= toJSON boost
1755+ , "boost" .= boost
1756− , "analyzer" .= toJSON analyzer
1756+ , "analyzer" .= analyzer
1757− , "disable_coord" .= toJSON disableCoord
1757+ , "disable_coord" .= disableCoord
1758− , "high_freq_operator" .= toJSON hfo ]
1758+ , "high_freq_operator" .= hfo ]
1761instance ToJSON CommonMinimumMatch where
1761instance ToJSON CommonMinimumMatch where
1762 toJSON (CommonMinimumMatch mm) = toJSON mm
1762 toJSON (CommonMinimumMatch mm) = toJSON mm
1763 toJSON (CommonMinimumMatchHighLow (MinimumMatchHighLow lowF highF)) =
1763 toJSON (CommonMinimumMatchHighLow (MinimumMatchHighLow lowF highF)) =
1764− object [ "low_freq" .= toJSON lowF
1764+ object [ "low_freq" .= lowF
1765− , "high_freq" .= toJSON highF ]
1765+ , "high_freq" .= highF ]
1767instance ToJSON BoostingQuery where
1767instance ToJSON BoostingQuery where
1768 toJSON (BoostingQuery bqPositiveQuery bqNegativeQuery bqNegativeBoost) =
1768 toJSON (BoostingQuery bqPositiveQuery bqNegativeQuery bqNegativeBoost) =
1769− object [ "positive" .= toJSON bqPositiveQuery
1769+ object [ "positive" .= bqPositiveQuery
1770− , "negative" .= toJSON bqNegativeQuery
1770+ , "negative" .= bqNegativeQuery
1771− , "negative_boost" .= toJSON bqNegativeBoost ]
1771+ , "negative_boost" .= bqNegativeBoost ]
1774instance ToJSON BoolQuery where
1774instance ToJSON BoolQuery where
1775 toJSON (BoolQuery mustM notM shouldM bqMin boost disableCoord) =
1775 toJSON (BoolQuery mustM notM shouldM bqMin boost disableCoord) =
1776 omitNulls base
1776 omitNulls base
1777− where base = [ "must" .= toJSON mustM
1777+ where base = [ "must" .= mustM
1778− , "must_not" .= toJSON notM
1778+ , "must_not" .= notM
1779− , "should" .= toJSON shouldM
1779+ , "should" .= shouldM
1780− , "minimum_should_match" .= toJSON bqMin
1780+ , "minimum_should_match" .= bqMin
1781− , "boost" .= toJSON boost
1781+ , "boost" .= boost
1782− , "disable_coord" .= toJSON disableCoord ]
1782+ , "disable_coord" .= disableCoord ]
1785instance ToJSON MatchQuery where
1785instance ToJSON MatchQuery where
@@ -1789,13 +1789,13 @@ instance ToJSON MatchQuery where
1789 analyzer maxExpansions lenient) =
1789 analyzer maxExpansions lenient) =
1790 object [ fieldName .= omitNulls base ]
1790 object [ fieldName .= omitNulls base ]
1791 where base = [ "query" .= mqQueryString
1791 where base = [ "query" .= mqQueryString
1792− , "operator" .= toJSON booleanOperator
1792+ , "operator" .= booleanOperator
1793− , "zero_terms_query" .= toJSON zeroTermsQuery
1793+ , "zero_terms_query" .= zeroTermsQuery
1794− , "cutoff_frequency" .= toJSON cutoffFrequency
1794+ , "cutoff_frequency" .= cutoffFrequency
1795− , "type" .= toJSON matchQueryType
1795+ , "type" .= matchQueryType
1796− , "analyzer" .= toJSON analyzer
1796+ , "analyzer" .= analyzer
1797− , "max_expansions" .= toJSON maxExpansions
1797+ , "max_expansions" .= maxExpansions
1798− , "lenient" .= toJSON lenient ]
1798+ , "lenient" .= lenient ]
1801instance ToJSON MultiMatchQuery where
1801instance ToJSON MultiMatchQuery where
@@ -1804,14 +1804,14 @@ instance ToJSON MultiMatchQuery where
1804 object ["multi_match" .= omitNulls base]
1804 object ["multi_match" .= omitNulls base]
1805 where base = [ "fields" .= fmap toJSON fields
1805 where base = [ "fields" .= fmap toJSON fields
1806 , "query" .= query
1806 , "query" .= query
1807− , "operator" .= toJSON boolOp
1807+ , "operator" .= boolOp
1808− , "zero_terms_query" .= toJSON ztQ
1808+ , "zero_terms_query" .= ztQ
1809− , "tiebreaker" .= toJSON tb
1809+ , "tiebreaker" .= tb
1810− , "type" .= toJSON mmqt
1810+ , "type" .= mmqt
1811− , "cutoff_frequency" .= toJSON cf
1811+ , "cutoff_frequency" .= cf
1812− , "analyzer" .= toJSON analyzer
1812+ , "analyzer" .= analyzer
1813− , "max_expansions" .= toJSON maxEx
1813+ , "max_expansions" .= maxEx
1814− , "lenient" .= toJSON lenient ]
1814+ , "lenient" .= lenient ]
1817instance ToJSON MultiMatchQueryType where
1817instance ToJSON MultiMatchQueryType where
@@ -1923,7 +1923,7 @@ instance ToJSON FieldHighlight where
1924instance ToJSON Highlights where
1924instance ToJSON Highlights where
1925 toJSON (Highlights global fields) =
1925 toJSON (Highlights global fields) =
1926− omitNulls (("fields" .= toJSON fields)
1926+ omitNulls (("fields" .= fields)
1927 : highlightSettingsPairs global)
1927 : highlightSettingsPairs global)
1929instance ToJSON HighlightSettings where
1929instance ToJSON HighlightSettings where
@@ -2001,16 +2001,16 @@ instance ToJSON SortSpec where
2001 (DefaultSort (FieldName dsSortFieldName) dsSortOrder dsIgnoreUnmapped
2001 (DefaultSort (FieldName dsSortFieldName) dsSortOrder dsIgnoreUnmapped
2002 dsSortMode dsMissingSort dsNestedFilter)) =
2002 dsSortMode dsMissingSort dsNestedFilter)) =
2003 object [dsSortFieldName .= omitNulls base] where
2003 object [dsSortFieldName .= omitNulls base] where
2004− base = [ "order" .= toJSON dsSortOrder
2004+ base = [ "order" .= dsSortOrder
2005 , "ignore_unmapped" .= dsIgnoreUnmapped
2005 , "ignore_unmapped" .= dsIgnoreUnmapped
2006 , "mode" .= dsSortMode
2006 , "mode" .= dsSortMode
2007 , "missing" .= dsMissingSort
2007 , "missing" .= dsMissingSort
2008 , "nested_filter" .= dsNestedFilter ]
2008 , "nested_filter" .= dsNestedFilter ]
2010 toJSON (GeoDistanceSortSpec gdsSortOrder (GeoPoint (FieldName field) gdsLatLon) units) =
2010 toJSON (GeoDistanceSortSpec gdsSortOrder (GeoPoint (FieldName field) gdsLatLon) units) =
2011− object [ "unit" .= toJSON units
2011+ object [ "unit" .= units
2012− , field .= toJSON gdsLatLon
2012+ , field .= gdsLatLon
2013− , "order" .= toJSON gdsSortOrder ]
2013+ , "order" .= gdsSortOrder ]
2016instance ToJSON SortOrder where
2016instance ToJSON SortOrder where
@@ -2072,7 +2072,7 @@ instance ToJSON OptimizeBbox where
2072instance ToJSON GeoBoundingBoxConstraint where
2072instance ToJSON GeoBoundingBoxConstraint where
2073 toJSON (GeoBoundingBoxConstraint
2073 toJSON (GeoBoundingBoxConstraint
2074 (FieldName gbbcGeoBBField) gbbcConstraintBox cache type') =
2074 (FieldName gbbcGeoBBField) gbbcConstraintBox cache type') =
2075− object [gbbcGeoBBField .= toJSON gbbcConstraintBox
2075+ object [gbbcGeoBBField .= gbbcConstraintBox
2076 , "_cache" .= cache
2076 , "_cache" .= cache
2077 , "type" .= type']
2077 , "type" .= type']
@@ -2084,8 +2084,8 @@ instance ToJSON GeoFilterType where
2085instance ToJSON GeoBoundingBox where
2085instance ToJSON GeoBoundingBox where
2086 toJSON (GeoBoundingBox gbbTopLeft gbbBottomRight) =
2086 toJSON (GeoBoundingBox gbbTopLeft gbbBottomRight) =
2087− object ["top_left" .= toJSON gbbTopLeft
2087+ object ["top_left" .= gbbTopLeft
2088− , "bottom_right" .= toJSON gbbBottomRight]
2088+ , "bottom_right" .= gbbBottomRight]
2091instance ToJSON LatLon where
2091instance ToJSON LatLon where
@@ -2118,9 +2118,9 @@ instance ToJSON Term where
2120instance ToJSON BoolMatch where
2120instance ToJSON BoolMatch where
2121− toJSON (MustMatch term cache) = object ["must" .= toJSON term,
2121+ toJSON (MustMatch term cache) = object ["must" .= term,
2122 "_cache" .= cache]
2122 "_cache" .= cache]
2123− toJSON (MustNotMatch term cache) = object ["must_not" .= toJSON term,
2123+ toJSON (MustNotMatch term cache) = object ["must_not" .= term,
2124 "_cache" .= cache]
2124 "_cache" .= cache]
2125 toJSON (ShouldMatch terms cache) = object ["should" .= fmap toJSON terms,
2125 toJSON (ShouldMatch terms cache) = object ["should" .= fmap toJSON terms,
2126 "_cache" .= cache]
2126 "_cache" .= cache]