@@ -305,6 +305,7 @@ import GHC.Enum
305import GHC.Generics (Generic)
305import GHC.Generics (Generic)
306import Network.HTTP.Client
306import Network.HTTP.Client
307import qualified Network.HTTP.Types.Method as NHTM
307import qualified Network.HTTP.Types.Method as NHTM
308+import qualified Text.Read as TR
309import Database.Bloodhound.Types.Class
310import Database.Bloodhound.Types.Class
310import Database.Bloodhound.Types.Internal
311import Database.Bloodhound.Types.Internal
@@ -363,7 +364,7 @@ data Version = Version { number :: Text
363 , build_hash :: Text
364 , build_hash :: Text
364 , build_timestamp :: UTCTime
365 , build_timestamp :: UTCTime
365 , build_snapshot :: Bool
366 , build_snapshot :: Bool
366− , lucene_version :: Text } deriving (Eq, Show, Generic, Typeable)
367+ , lucene_version :: Text } deriving (Eq, Read, Show, Generic, Typeable)
368{-| 'Status' is a data type for describing the JSON body returned by
369{-| 'Status' is a data type for describing the JSON body returned by
369 Elasticsearch when you query its status. This was deprecated in 1.2.0.
370 Elasticsearch when you query its status. This was deprecated in 1.2.0.
@@ -375,7 +376,7 @@ data Status = Status { ok :: Maybe Bool
375 , status :: Int
376 , status :: Int
376 , name :: Text
377 , name :: Text
377 , version :: Version
378 , version :: Version
378− , tagline :: Text } deriving (Eq, Show, Generic)
379+ , tagline :: Text } deriving (Eq, Read, Show, Generic)
380{-| 'IndexSettings' is used to configure the shards and replicas when you create
381{-| 'IndexSettings' is used to configure the shards and replicas when you create
381 an Elasticsearch Index.
382 an Elasticsearch Index.
@@ -385,7 +386,7 @@ data Status = Status { ok :: Maybe Bool
386data IndexSettings =
387data IndexSettings =
387 IndexSettings { indexShards :: ShardCount
388 IndexSettings { indexShards :: ShardCount
388− , indexReplicas :: ReplicaCount } deriving (Eq, Show, Generic, Typeable)
389+ , indexReplicas :: ReplicaCount } deriving (Eq, Read, Show, Generic, Typeable)
390{-| 'defaultIndexSettings' is an 'IndexSettings' with 3 shards and 2 replicas. -}
391{-| 'defaultIndexSettings' is an 'IndexSettings' with 3 shards and 2 replicas. -}
391defaultIndexSettings :: IndexSettings
392defaultIndexSettings :: IndexSettings
@@ -475,35 +476,35 @@ data AllocationPolicy = AllocAll
475 -- ^ Allows shard allocation only for primary shards for new indices.
476 -- ^ Allows shard allocation only for primary shards for new indices.
476 | AllocNone
477 | AllocNone
477 -- ^ No shard allocation is allowed
478 -- ^ No shard allocation is allowed
478− deriving (Eq, Show, Generic, Typeable)
479+ deriving (Eq, Read, Show, Generic, Typeable)
480data ReplicaBounds = ReplicasBounded Int Int
481data ReplicaBounds = ReplicasBounded Int Int
481 | ReplicasLowerBounded Int
482 | ReplicasLowerBounded Int
482 | ReplicasUnbounded
483 | ReplicasUnbounded
483− deriving (Eq, Show, Generic, Typeable)
484+ deriving (Eq, Read, Show, Generic, Typeable)
485−newtype Bytes = Bytes Int deriving (Eq, Show, Generic, Typeable, Ord, ToJSON, FromJSON)
486+newtype Bytes = Bytes Int deriving (Eq, Read, Show, Generic, Typeable, Ord, ToJSON, FromJSON)
487data FSType = FSSimple
488data FSType = FSSimple
488− | FSBuffered deriving (Eq, Show, Generic, Typeable, Ord)
489+ | FSBuffered deriving (Eq, Read, Show, Generic, Typeable, Ord)
490data InitialShardCount = QuorumShards
491data InitialShardCount = QuorumShards
491 | QuorumMinus1Shards
492 | QuorumMinus1Shards
492 | FullShards
493 | FullShards
493 | FullMinus1Shards
494 | FullMinus1Shards
494 | ExplicitShards Int
495 | ExplicitShards Int
495− deriving (Eq, Show, Generic, Typeable)
496+ deriving (Eq, Read, Show, Generic, Typeable)
497data NodeAttrFilter = NodeAttrFilter { nodeAttrFilterName :: NodeAttrName
498data NodeAttrFilter = NodeAttrFilter { nodeAttrFilterName :: NodeAttrName
498 , nodeAttrFilterValues :: NonEmpty Text}
499 , nodeAttrFilterValues :: NonEmpty Text}
499− deriving (Eq, Show, Generic, Ord)
500+ deriving (Eq, Read, Show, Generic, Ord)
501−newtype NodeAttrName = NodeAttrName Text deriving (Eq, Show, Ord, Generic, Typeable)
502+newtype NodeAttrName = NodeAttrName Text deriving (Eq, Read, Show, Ord, Generic, Typeable)
503data CompoundFormat = CompoundFileFormat Bool
504data CompoundFormat = CompoundFileFormat Bool
504 | MergeSegmentVsTotalIndex Double
505 | MergeSegmentVsTotalIndex Double
505 -- ^ percentage between 0 and 1 where 0 is false, 1 is true
506 -- ^ percentage between 0 and 1 where 0 is false, 1 is true
506− deriving (Eq, Show, Generic, Typeable)
507+ deriving (Eq, Read, Show, Generic, Typeable)
508newtype NominalDiffTimeJSON = NominalDiffTimeJSON { ndtJSON :: NominalDiffTime }
509newtype NominalDiffTimeJSON = NominalDiffTimeJSON { ndtJSON :: NominalDiffTime }
@@ -520,7 +521,7 @@ type Method = NHTM.Method
521 <http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-open-close.html>
522 <http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-open-close.html>
523−data OpenCloseIndex = OpenIndex | CloseIndex deriving (Eq, Show, Generic, Typeable)
524+data OpenCloseIndex = OpenIndex | CloseIndex deriving (Eq, Read, Show, Generic, Typeable)
525data FieldType = GeoPointType
526data FieldType = GeoPointType
526 | GeoShapeType
527 | GeoShapeType
@@ -528,10 +529,10 @@ data FieldType = GeoPointType
528 | IntegerType
529 | IntegerType
529 | LongType
530 | LongType
530 | ShortType
531 | ShortType
531− | ByteType deriving (Eq, Show, Generic, Typeable)
532+ | ByteType deriving (Eq, Read, Show, Generic, Typeable)
533data FieldDefinition =
534data FieldDefinition =
534− FieldDefinition { fieldType :: FieldType } deriving (Eq, Show, Generic, Typeable)
535+ FieldDefinition { fieldType :: FieldType } deriving (Eq, Read, Show, Generic, Typeable)
536{-| An 'IndexTemplate' defines a template that will automatically be
537{-| An 'IndexTemplate' defines a template that will automatically be
537 applied to new indices created. The templates include both
538 applied to new indices created. The templates include both
@@ -549,7 +550,7 @@ data IndexTemplate =
550data MappingField =
551data MappingField =
551 MappingField { mappingFieldName :: FieldName
552 MappingField { mappingFieldName :: FieldName
552− , fieldDefinition :: FieldDefinition } deriving (Eq, Show, Generic, Typeable)
553+ , fieldDefinition :: FieldDefinition } deriving (Eq, Read, Show, Generic, Typeable)
554{-| Support for type reification of 'Mapping's is currently incomplete, for
555{-| Support for type reification of 'Mapping's is currently incomplete, for
555 now the mapping API verbiage expects a 'ToJSON'able blob.
556 now the mapping API verbiage expects a 'ToJSON'able blob.
@@ -559,7 +560,7 @@ data MappingField =
559 and keeping different kinds of documents separated if possible.
560 and keeping different kinds of documents separated if possible.
561data Mapping = Mapping { typeName :: TypeName
562data Mapping = Mapping { typeName :: TypeName
562− , mappingFields :: [MappingField] } deriving (Eq, Show, Generic, Typeable)
563+ , mappingFields :: [MappingField] } deriving (Eq, Read, Show, Generic, Typeable)
564{-| 'BulkOperation' is a sum type for expressing the four kinds of bulk
565{-| 'BulkOperation' is a sum type for expressing the four kinds of bulk
565 operation index, create, delete, and update. 'BulkIndex' behaves like an
566 operation index, create, delete, and update. 'BulkIndex' behaves like an
@@ -571,7 +572,7 @@ data BulkOperation =
571 BulkIndex IndexName MappingName DocId Value
572 BulkIndex IndexName MappingName DocId Value
572 | BulkCreate IndexName MappingName DocId Value
573 | BulkCreate IndexName MappingName DocId Value
573 | BulkDelete IndexName MappingName DocId
574 | BulkDelete IndexName MappingName DocId
574− | BulkUpdate IndexName MappingName DocId Value deriving (Eq, Show, Generic, Typeable)
575+ | BulkUpdate IndexName MappingName DocId Value deriving (Eq, Read, Show, Generic, Typeable)
576{-| 'EsResult' describes the standard wrapper JSON document that you see in
577{-| 'EsResult' describes the standard wrapper JSON document that you see in
577 successful Elasticsearch lookups or lookups that couldn't find the document.
578 successful Elasticsearch lookups or lookups that couldn't find the document.
@@ -579,20 +580,20 @@ data BulkOperation =
579data EsResult a = EsResult { _index :: Text
580data EsResult a = EsResult { _index :: Text
580 , _type :: Text
581 , _type :: Text
581 , _id :: Text
582 , _id :: Text
582− , foundResult :: Maybe (EsResultFound a)} deriving (Eq, Show, Generic, Typeable)
583+ , foundResult :: Maybe (EsResultFound a)} deriving (Eq, Read, Show, Generic, Typeable)
584{-| 'EsResultFound' contains the document and its metadata inside of an
585{-| 'EsResultFound' contains the document and its metadata inside of an
585 'EsResult' when the document was successfully found.
586 'EsResult' when the document was successfully found.
587data EsResultFound a = EsResultFound { _version :: DocVersion
588data EsResultFound a = EsResultFound { _version :: DocVersion
588− , _source :: a } deriving (Eq, Show, Generic, Typeable)
589+ , _source :: a } deriving (Eq, Read, Show, Generic, Typeable)
590{-| 'EsError' is the generic type that will be returned when there was a
591{-| 'EsError' is the generic type that will be returned when there was a
591 problem. If you can't parse the expected response, its a good idea to
592 problem. If you can't parse the expected response, its a good idea to
592 try parsing this.
593 try parsing this.
594data EsError = EsError { errorStatus :: Int
595data EsError = EsError { errorStatus :: Int
595− , errorMessage :: Text } deriving (Eq, Show, Generic, Typeable)
596+ , errorMessage :: Text } deriving (Eq, Read, Show, Generic, Typeable)
597{-| 'EsProtocolException' will be thrown if Bloodhound cannot parse a response
598{-| 'EsProtocolException' will be thrown if Bloodhound cannot parse a response
598returned by the ElasticSearch server. If you encounter this error, please
599returned by the ElasticSearch server. If you encounter this error, please
@@ -603,44 +604,44 @@ incompatibility between Bloodhound and ElasticSearch. Please open a bug report
603and be sure to include the exception body.
604and be sure to include the exception body.
605data EsProtocolException = EsProtocolException { esProtoExBody :: L.ByteString }
606data EsProtocolException = EsProtocolException { esProtoExBody :: L.ByteString }
606− deriving (Eq, Show, Generic, Typeable)
607+ deriving (Eq, Read, Show, Generic, Typeable)
608instance Exception EsProtocolException
609instance Exception EsProtocolException
610data IndexAlias = IndexAlias { srcIndex :: IndexName
611data IndexAlias = IndexAlias { srcIndex :: IndexName
611− , indexAlias :: IndexAliasName } deriving (Eq, Show, Generic, Typeable)
612+ , indexAlias :: IndexAliasName } deriving (Eq, Read, Show, Generic, Typeable)
613−newtype IndexAliasName = IndexAliasName { indexAliasName :: IndexName } deriving (Eq, Show, Generic, ToJSON)
614+newtype IndexAliasName = IndexAliasName { indexAliasName :: IndexName } deriving (Eq, Read, Show, Generic, ToJSON)
615data IndexAliasAction = AddAlias IndexAlias IndexAliasCreate
616data IndexAliasAction = AddAlias IndexAlias IndexAliasCreate
616− | RemoveAlias IndexAlias deriving (Show, Eq, Generic, Typeable)
617+ | RemoveAlias IndexAlias deriving (Read, Show, Eq, Generic, Typeable)
618data IndexAliasCreate = IndexAliasCreate { aliasCreateRouting :: Maybe AliasRouting
619data IndexAliasCreate = IndexAliasCreate { aliasCreateRouting :: Maybe AliasRouting
619 , aliasCreateFilter :: Maybe Filter}
620 , aliasCreateFilter :: Maybe Filter}
620− deriving (Show, Eq, Generic, Typeable)
621+ deriving (Read, Show, Eq, Generic, Typeable)
622data AliasRouting = AllAliasRouting RoutingValue
623data AliasRouting = AllAliasRouting RoutingValue
623 | GranularAliasRouting (Maybe SearchAliasRouting) (Maybe IndexAliasRouting)
624 | GranularAliasRouting (Maybe SearchAliasRouting) (Maybe IndexAliasRouting)
624− deriving (Show, Eq, Generic, Typeable)
625+ deriving (Read, Show, Eq, Generic, Typeable)
626−newtype SearchAliasRouting = SearchAliasRouting (NonEmpty RoutingValue) deriving (Show, Eq, Generic, Typeable)
627+newtype SearchAliasRouting = SearchAliasRouting (NonEmpty RoutingValue) deriving (Read, Show, Eq, Generic, Typeable)
628−newtype IndexAliasRouting = IndexAliasRouting RoutingValue deriving (Show, Eq, Generic, ToJSON, FromJSON, Typeable)
629+newtype IndexAliasRouting = IndexAliasRouting RoutingValue deriving (Read, Show, Eq, Generic, ToJSON, FromJSON, Typeable)
630−newtype RoutingValue = RoutingValue { routingValue :: Text } deriving (Show, Eq, Generic, ToJSON, FromJSON, Typeable)
631+newtype RoutingValue = RoutingValue { routingValue :: Text } deriving (Read, Show, Eq, Generic, ToJSON, FromJSON, Typeable)
632−newtype IndexAliasesSummary = IndexAliasesSummary { indexAliasesSummary :: [IndexAliasSummary] } deriving (Show, Eq, Generic, Typeable)
633+newtype IndexAliasesSummary = IndexAliasesSummary { indexAliasesSummary :: [IndexAliasSummary] } deriving (Read, Show, Eq, Generic, Typeable)
634{-| 'IndexAliasSummary' is a summary of an index alias configured for a server. -}
635{-| 'IndexAliasSummary' is a summary of an index alias configured for a server. -}
635data IndexAliasSummary = IndexAliasSummary { indexAliasSummaryAlias :: IndexAlias
636data IndexAliasSummary = IndexAliasSummary { indexAliasSummaryAlias :: IndexAlias
636− , indexAliasSummaryCreate :: IndexAliasCreate} deriving (Show, Eq, Generic, Typeable)
637+ , indexAliasSummaryCreate :: IndexAliasCreate} deriving (Read, Show, Eq, Generic, Typeable)
638{-| 'DocVersion' is an integer version number for a document between 1
639{-| 'DocVersion' is an integer version number for a document between 1
639and 9.2e+18 used for <<https://www.elastic.co/guide/en/elasticsearch/guide/current/optimistic-concurrency-control.html optimistic concurrency control>>.
640and 9.2e+18 used for <<https://www.elastic.co/guide/en/elasticsearch/guide/current/optimistic-concurrency-control.html optimistic concurrency control>>.
641newtype DocVersion = DocVersion {
642newtype DocVersion = DocVersion {
642 docVersionNumber :: Int
643 docVersionNumber :: Int
643− } deriving (Eq, Show, Generic, Ord, ToJSON)
644+ } deriving (Eq, Read, Show, Generic, Ord, ToJSON)
645-- | Smart constructor for in-range doc version
646-- | Smart constructor for in-range doc version
646mkDocVersion :: Int -> Maybe DocVersion
647mkDocVersion :: Int -> Maybe DocVersion
@@ -654,7 +655,7 @@ mkDocVersion i
654own version numbers instead of ones from ES.
655own version numbers instead of ones from ES.
656newtype ExternalDocVersion = ExternalDocVersion DocVersion
657newtype ExternalDocVersion = ExternalDocVersion DocVersion
657− deriving (Eq, Show, Generic, Ord, Bounded, Enum, ToJSON)
658+ deriving (Eq, Read, Show, Generic, Ord, Bounded, Enum, ToJSON)
659{-| 'VersionControl' is specified when indexing documents as a
660{-| 'VersionControl' is specified when indexing documents as a
660optimistic concurrency control.
661optimistic concurrency control.
@@ -688,12 +689,12 @@ data VersionControl = NoVersionControl
688 -- given version will be the new version. This is
689 -- given version will be the new version. This is
689 -- typically used for correcting errors. Use with
690 -- typically used for correcting errors. Use with
690 -- care, as this could result in data loss.
691 -- care, as this could result in data loss.
691− deriving (Show, Eq, Generic, Ord)
692+ deriving (Read, Show, Eq, Generic, Ord)
693{-| 'DocumentParent' is used to specify a parent document.
694{-| 'DocumentParent' is used to specify a parent document.
695newtype DocumentParent = DocumentParent DocId
696newtype DocumentParent = DocumentParent DocId
696− deriving (Eq, Show, Generic, Typeable)
697+ deriving (Eq, Read, Show, Generic, Typeable)
698{-| 'IndexDocumentSettings' are special settings supplied when indexing
699{-| 'IndexDocumentSettings' are special settings supplied when indexing
699a document. For the best backwards compatiblity when new fields are
700a document. For the best backwards compatiblity when new fields are
@@ -702,7 +703,7 @@ added, you should probably prefer to start with 'defaultIndexDocumentSettings'
702data IndexDocumentSettings =
703data IndexDocumentSettings =
703 IndexDocumentSettings { idsVersionControl :: VersionControl
704 IndexDocumentSettings { idsVersionControl :: VersionControl
704 , idsParent :: Maybe DocumentParent
705 , idsParent :: Maybe DocumentParent
705− } deriving (Eq, Show, Generic, Typeable)
706+ } deriving (Eq, Read, Show, Generic, Typeable)
707{-| Reasonable default settings. Chooses no version control and no parent.
708{-| Reasonable default settings. Chooses no version control and no parent.
@@ -722,7 +723,7 @@ type Sort = [SortSpec]
722<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-sort.html#search-request-sort>
723<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-sort.html#search-request-sort>
724data SortSpec = DefaultSortSpec DefaultSort
725data SortSpec = DefaultSortSpec DefaultSort
725− | GeoDistanceSortSpec SortOrder GeoPoint DistanceUnit deriving (Eq, Show, Generic, Typeable)
726+ | GeoDistanceSortSpec SortOrder GeoPoint DistanceUnit deriving (Eq, Read, Show, Generic, Typeable)
727{-| 'DefaultSort' is usually the kind of 'SortSpec' you'll want. There's a
728{-| 'DefaultSort' is usually the kind of 'SortSpec' you'll want. There's a
728 'mkSort' convenience function for when you want to specify only the most
729 'mkSort' convenience function for when you want to specify only the most
@@ -737,7 +738,7 @@ data DefaultSort =
737 , ignoreUnmapped :: Bool
738 , ignoreUnmapped :: Bool
738 , sortMode :: Maybe SortMode
739 , sortMode :: Maybe SortMode
739 , missingSort :: Maybe Missing
740 , missingSort :: Maybe Missing
740− , nestedFilter :: Maybe Filter } deriving (Eq, Show, Generic, Typeable)
741+ , nestedFilter :: Maybe Filter } deriving (Eq, Read, Show, Generic, Typeable)
742{-| 'SortOrder' is 'Ascending' or 'Descending', as you might expect. These get
743{-| 'SortOrder' is 'Ascending' or 'Descending', as you might expect. These get
743 encoded into "asc" or "desc" when turned into JSON.
744 encoded into "asc" or "desc" when turned into JSON.
@@ -745,7 +746,7 @@ data DefaultSort =
745<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-sort.html#search-request-sort>
746<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-sort.html#search-request-sort>
747data SortOrder = Ascending
748data SortOrder = Ascending
748− | Descending deriving (Eq, Show, Generic, Typeable)
749+ | Descending deriving (Eq, Read, Show, Generic, Typeable)
750{-| 'Missing' prescribes how to handle missing fields. A missing field can be
751{-| 'Missing' prescribes how to handle missing fields. A missing field can be
751 sorted last, first, or using a custom value as a substitute.
752 sorted last, first, or using a custom value as a substitute.
@@ -754,7 +755,7 @@ data SortOrder = Ascending
755data Missing = LastMissing
756data Missing = LastMissing
756 | FirstMissing
757 | FirstMissing
757− | CustomMissing Text deriving (Eq, Show, Generic, Typeable)
758+ | CustomMissing Text deriving (Eq, Read, Show, Generic, Typeable)
759{-| 'SortMode' prescribes how to handle sorting array/multi-valued fields.
760{-| 'SortMode' prescribes how to handle sorting array/multi-valued fields.
@@ -763,7 +764,7 @@ http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-req
763data SortMode = SortMin
764data SortMode = SortMin
764 | SortMax
765 | SortMax
765 | SortSum
766 | SortSum
766− | SortAvg deriving (Eq, Show, Generic, Typeable)
767+ | SortAvg deriving (Eq, Read, Show, Generic, Typeable)
768{-| 'mkSort' defaults everything but the 'FieldName' and the 'SortOrder' so
769{-| 'mkSort' defaults everything but the 'FieldName' and the 'SortOrder' so
769 that you can concisely describe the usual kind of 'SortSpec's you want.
770 that you can concisely describe the usual kind of 'SortSpec's you want.
@@ -785,19 +786,19 @@ type PrefixValue = Text
785{-| 'BooleanOperator' is the usual And/Or operators with an ES compatible
786{-| 'BooleanOperator' is the usual And/Or operators with an ES compatible
786 JSON encoding baked in. Used all over the place.
787 JSON encoding baked in. Used all over the place.
788−data BooleanOperator = And | Or deriving (Eq, Show, Generic, Typeable)
789+data BooleanOperator = And | Or deriving (Eq, Read, Show, Generic, Typeable)
790{-| 'ShardCount' is part of 'IndexSettings'
791{-| 'ShardCount' is part of 'IndexSettings'
792−newtype ShardCount = ShardCount Int deriving (Eq, Show, Generic, ToJSON, Typeable)
793+newtype ShardCount = ShardCount Int deriving (Eq, Read, Show, Generic, ToJSON, Typeable)
794{-| 'ReplicaCount' is part of 'IndexSettings'
795{-| 'ReplicaCount' is part of 'IndexSettings'
796−newtype ReplicaCount = ReplicaCount Int deriving (Eq, Show, Generic, ToJSON, Typeable)
797+newtype ReplicaCount = ReplicaCount Int deriving (Eq, Read, Show, Generic, ToJSON, Typeable)
798{-| 'IndexName' is used to describe which index to query/create/delete
799{-| 'IndexName' is used to describe which index to query/create/delete
800−newtype IndexName = IndexName Text deriving (Eq, Generic, Show, ToJSON, FromJSON, Typeable)
801+newtype IndexName = IndexName Text deriving (Eq, Generic, Read, Show, ToJSON, FromJSON, Typeable)
802{-| 'IndexSelection' is used for APIs which take a single index, a list of
803{-| 'IndexSelection' is used for APIs which take a single index, a list of
803 indexes, or the special @_all@ index.
804 indexes, or the special @_all@ index.
@@ -807,133 +808,133 @@ data IndexSelection = IndexList (NonEmpty IndexName)
808{-| 'TemplateName' is used to describe which template to query/create/delete
809{-| 'TemplateName' is used to describe which template to query/create/delete
810−newtype TemplateName = TemplateName Text deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
811+newtype TemplateName = TemplateName Text deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
812{-| 'TemplatePattern' represents a pattern which is matched against index names
813{-| 'TemplatePattern' represents a pattern which is matched against index names
814−newtype TemplatePattern = TemplatePattern Text deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
815+newtype TemplatePattern = TemplatePattern Text deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
816{-| 'MappingName' is part of mappings which are how ES describes and schematizes
817{-| 'MappingName' is part of mappings which are how ES describes and schematizes
817 the data in the indices.
818 the data in the indices.
819−newtype MappingName = MappingName Text deriving (Eq, Generic, Show, ToJSON, FromJSON, Typeable)
820+newtype MappingName = MappingName Text deriving (Eq, Generic, Read, Show, ToJSON, FromJSON, Typeable)
821{-| 'DocId' is a generic wrapper value for expressing unique Document IDs.
822{-| 'DocId' is a generic wrapper value for expressing unique Document IDs.
822 Can be set by the user or created by ES itself. Often used in client
823 Can be set by the user or created by ES itself. Often used in client
823 functions for poking at specific documents.
824 functions for poking at specific documents.
825−newtype DocId = DocId Text deriving (Eq, Generic, Show, ToJSON, FromJSON, Typeable)
826+newtype DocId = DocId Text deriving (Eq, Generic, Read, Show, ToJSON, FromJSON, Typeable)
827{-| 'QueryString' is used to wrap query text bodies, be they human written or not.
828{-| 'QueryString' is used to wrap query text bodies, be they human written or not.
829−newtype QueryString = QueryString Text deriving (Eq, Generic, Show, ToJSON, FromJSON, Typeable)
830+newtype QueryString = QueryString Text deriving (Eq, Generic, Read, Show, ToJSON, FromJSON, Typeable)
831{-| 'FieldName' is used all over the place wherever a specific field within
832{-| 'FieldName' is used all over the place wherever a specific field within
832 a document needs to be specified, usually in 'Query's or 'Filter's.
833 a document needs to be specified, usually in 'Query's or 'Filter's.
834−newtype FieldName = FieldName Text deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
835+newtype FieldName = FieldName Text deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
837{-| 'Script' is often used in place of 'FieldName' to specify more
838{-| 'Script' is often used in place of 'FieldName' to specify more
838complex ways of extracting a value from a document.
839complex ways of extracting a value from a document.
840−newtype Script = Script { scriptText :: Text } deriving (Eq, Show, Generic, Typeable)
841+newtype Script = Script { scriptText :: Text } deriving (Eq, Read, Show, Generic, Typeable)
842{-| 'CacheName' is used in 'RegexpFilter' for describing the
843{-| 'CacheName' is used in 'RegexpFilter' for describing the
843 'CacheKey' keyed caching behavior.
844 'CacheKey' keyed caching behavior.
845−newtype CacheName = CacheName Text deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
846+newtype CacheName = CacheName Text deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
847{-| 'CacheKey' is used in 'RegexpFilter' to key regex caching.
848{-| 'CacheKey' is used in 'RegexpFilter' to key regex caching.
849newtype CacheKey =
850newtype CacheKey =
850− CacheKey Text deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
851+ CacheKey Text deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
851newtype Existence =
852newtype Existence =
852− Existence Bool deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
853+ Existence Bool deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
853newtype NullValue =
854newtype NullValue =
854− NullValue Bool deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
855+ NullValue Bool deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
855newtype CutoffFrequency =
856newtype CutoffFrequency =
856− CutoffFrequency Double deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
857+ CutoffFrequency Double deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
857newtype Analyzer =
858newtype Analyzer =
858− Analyzer Text deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
859+ Analyzer Text deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
859newtype MaxExpansions =
860newtype MaxExpansions =
860− MaxExpansions Int deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
861+ MaxExpansions Int deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
862{-| 'Lenient', if set to true, will cause format based failures to be
863{-| 'Lenient', if set to true, will cause format based failures to be
863 ignored. I don't know what the bloody default is, Elasticsearch
864 ignored. I don't know what the bloody default is, Elasticsearch
864 documentation didn't say what it was. Let me know if you figure it out.
865 documentation didn't say what it was. Let me know if you figure it out.
866newtype Lenient =
867newtype Lenient =
867− Lenient Bool deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
868+ Lenient Bool deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
868newtype Tiebreaker =
869newtype Tiebreaker =
869− Tiebreaker Double deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
870+ Tiebreaker Double deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
870newtype Boost =
871newtype Boost =
871− Boost Double deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
872+ Boost Double deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
872newtype BoostTerms =
873newtype BoostTerms =
873− BoostTerms Double deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
874+ BoostTerms Double deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
875{-| 'MinimumMatch' controls how many should clauses in the bool query should
876{-| 'MinimumMatch' controls how many should clauses in the bool query should
876 match. Can be an absolute value (2) or a percentage (30%) or a
877 match. Can be an absolute value (2) or a percentage (30%) or a
877 combination of both.
878 combination of both.
879newtype MinimumMatch =
880newtype MinimumMatch =
880− MinimumMatch Int deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
881+ MinimumMatch Int deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
881newtype DisableCoord =
882newtype DisableCoord =
882− DisableCoord Bool deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
883+ DisableCoord Bool deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
883newtype IgnoreTermFrequency =
884newtype IgnoreTermFrequency =
884− IgnoreTermFrequency Bool deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
885+ IgnoreTermFrequency Bool deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
885newtype MinimumTermFrequency =
886newtype MinimumTermFrequency =
886− MinimumTermFrequency Int deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
887+ MinimumTermFrequency Int deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
887newtype MaxQueryTerms =
888newtype MaxQueryTerms =
888− MaxQueryTerms Int deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
889+ MaxQueryTerms Int deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
889newtype Fuzziness =
890newtype Fuzziness =
890− Fuzziness Double deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
891+ Fuzziness Double deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
892{-| 'PrefixLength' is the prefix length used in queries, defaults to 0. -}
893{-| 'PrefixLength' is the prefix length used in queries, defaults to 0. -}
893newtype PrefixLength =
894newtype PrefixLength =
894− PrefixLength Int deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
895+ PrefixLength Int deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
895newtype TypeName =
896newtype TypeName =
896− TypeName Text deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
897+ TypeName Text deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
897newtype PercentMatch =
898newtype PercentMatch =
898− PercentMatch Double deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
899+ PercentMatch Double deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
899newtype StopWord =
900newtype StopWord =
900− StopWord Text deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
901+ StopWord Text deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
901newtype QueryPath =
902newtype QueryPath =
902− QueryPath Text deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
903+ QueryPath Text deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
904{-| Allowing a wildcard at the beginning of a word (eg "*ing") is particularly
905{-| Allowing a wildcard at the beginning of a word (eg "*ing") is particularly
905 heavy, because all terms in the index need to be examined, just in case
906 heavy, because all terms in the index need to be examined, just in case
906 they match. Leading wildcards can be disabled by setting
907 they match. Leading wildcards can be disabled by setting
907 'AllowLeadingWildcard' to false. -}
908 'AllowLeadingWildcard' to false. -}
908newtype AllowLeadingWildcard =
909newtype AllowLeadingWildcard =
909− AllowLeadingWildcard Bool deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
910+ AllowLeadingWildcard Bool deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
910newtype LowercaseExpanded =
911newtype LowercaseExpanded =
911− LowercaseExpanded Bool deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
912+ LowercaseExpanded Bool deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
912newtype EnablePositionIncrements =
913newtype EnablePositionIncrements =
913− EnablePositionIncrements Bool deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
914+ EnablePositionIncrements Bool deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
915{-| By default, wildcard terms in a query are not analyzed.
916{-| By default, wildcard terms in a query are not analyzed.
916 Setting 'AnalyzeWildcard' to true enables best-effort analysis.
917 Setting 'AnalyzeWildcard' to true enables best-effort analysis.
918−newtype AnalyzeWildcard = AnalyzeWildcard Bool deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
919+newtype AnalyzeWildcard = AnalyzeWildcard Bool deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
920{-| 'GeneratePhraseQueries' defaults to false.
921{-| 'GeneratePhraseQueries' defaults to false.
922newtype GeneratePhraseQueries =
923newtype GeneratePhraseQueries =
923− GeneratePhraseQueries Bool deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
924+ GeneratePhraseQueries Bool deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
925{-| 'Locale' is used for string conversions - defaults to ROOT.
926{-| 'Locale' is used for string conversions - defaults to ROOT.
927−newtype Locale = Locale Text deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
928+newtype Locale = Locale Text deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
928−newtype MaxWordLength = MaxWordLength Int deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
929+newtype MaxWordLength = MaxWordLength Int deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
929−newtype MinWordLength = MinWordLength Int deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
930+newtype MinWordLength = MinWordLength Int deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
931{-| 'PhraseSlop' sets the default slop for phrases, 0 means exact
932{-| 'PhraseSlop' sets the default slop for phrases, 0 means exact
932 phrase matches. Default is 0.
933 phrase matches. Default is 0.
934−newtype PhraseSlop = PhraseSlop Int deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
935+newtype PhraseSlop = PhraseSlop Int deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
935−newtype MinDocFrequency = MinDocFrequency Int deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
936+newtype MinDocFrequency = MinDocFrequency Int deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
936−newtype MaxDocFrequency = MaxDocFrequency Int deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
937+newtype MaxDocFrequency = MaxDocFrequency Int deriving (Eq, Read, Show, Generic, ToJSON, FromJSON, Typeable)
938-- | Newtype wrapper to parse ES's concerning tendency to in some APIs return a floating point number of milliseconds since epoch ಠ_ಠ
939-- | Newtype wrapper to parse ES's concerning tendency to in some APIs return a floating point number of milliseconds since epoch ಠ_ಠ
939newtype POSIXMS = POSIXMS { posixMS :: UTCTime }
940newtype POSIXMS = POSIXMS { posixMS :: UTCTime }
@@ -944,8 +945,8 @@ unpackId :: DocId -> Text
944unpackId (DocId docId) = docId
945unpackId (DocId docId) = docId
946type TrackSortScores = Bool
947type TrackSortScores = Bool
947−newtype From = From Int deriving (Eq, Show, Generic, ToJSON)
948+newtype From = From Int deriving (Eq, Read, Show, Generic, ToJSON)
948−newtype Size = Size Int deriving (Eq, Show, Generic, ToJSON)
949+newtype Size = Size Int deriving (Eq, Read, Show, Generic, ToJSON)
950data Search = Search { queryBody :: Maybe Query
951data Search = Search { queryBody :: Maybe Query
951 , filterBody :: Maybe Filter
952 , filterBody :: Maybe Filter
@@ -958,7 +959,7 @@ data Search = Search { queryBody :: Maybe Query
958 , size :: Size
959 , size :: Size
959 , searchType :: SearchType
960 , searchType :: SearchType
960 , fields :: Maybe [FieldName]
961 , fields :: Maybe [FieldName]
961− , source :: Maybe Source } deriving (Eq, Show, Generic, Typeable)
962+ , source :: Maybe Source } deriving (Eq, Read, Show, Generic, Typeable)
963data SearchType = SearchTypeQueryThenFetch
964data SearchType = SearchTypeQueryThenFetch
964 | SearchTypeDfsQueryThenFetch
965 | SearchTypeDfsQueryThenFetch
@@ -966,40 +967,40 @@ data SearchType = SearchTypeQueryThenFetch
966 | SearchTypeScan
967 | SearchTypeScan
967 | SearchTypeQueryAndFetch
968 | SearchTypeQueryAndFetch
968 | SearchTypeDfsQueryAndFetch
969 | SearchTypeDfsQueryAndFetch
969− deriving (Eq, Show, Generic, Typeable)
970+ deriving (Eq, Read, Show, Generic, Typeable)
971data Source =
972data Source =
973 | SourcePatterns PatternOrPatterns
974 | SourcePatterns PatternOrPatterns
974 | SourceIncludeExclude Include Exclude
975 | SourceIncludeExclude Include Exclude
975− deriving (Show, Eq, Generic, Typeable)
976+ deriving (Read, Show, Eq, Generic, Typeable)
977data PatternOrPatterns = PopPattern Pattern
978data PatternOrPatterns = PopPattern Pattern
978− | PopPatterns [Pattern] deriving (Eq, Show, Generic, Typeable)
979+ | PopPatterns [Pattern] deriving (Eq, Read, Show, Generic, Typeable)
980−data Include = Include [Pattern] deriving (Eq, Show, Generic, Typeable)
981+data Include = Include [Pattern] deriving (Eq, Read, Show, Generic, Typeable)
981−data Exclude = Exclude [Pattern] deriving (Eq, Show, Generic, Typeable)
982+data Exclude = Exclude [Pattern] deriving (Eq, Read, Show, Generic, Typeable)
983−newtype Pattern = Pattern Text deriving (Eq, Show, Generic, Typeable)
984+newtype Pattern = Pattern Text deriving (Eq, Read, Show, Generic, Typeable)
985data Highlights = Highlights { globalsettings :: Maybe HighlightSettings
986data Highlights = Highlights { globalsettings :: Maybe HighlightSettings
986 , highlightFields :: [FieldHighlight]
987 , highlightFields :: [FieldHighlight]
987− } deriving (Show, Eq, Generic, Typeable)
988+ } deriving (Read, Show, Eq, Generic, Typeable)
989data FieldHighlight = FieldHighlight FieldName (Maybe HighlightSettings)
990data FieldHighlight = FieldHighlight FieldName (Maybe HighlightSettings)
990− deriving (Show, Eq, Generic, Typeable)
991+ deriving (Read, Show, Eq, Generic, Typeable)
993data HighlightSettings = Plain PlainHighlight
994data HighlightSettings = Plain PlainHighlight
994 | Postings PostingsHighlight
995 | Postings PostingsHighlight
995 | FastVector FastVectorHighlight
996 | FastVector FastVectorHighlight
996− deriving (Show, Eq, Generic, Typeable)
997+ deriving (Read, Show, Eq, Generic, Typeable)
997data PlainHighlight =
998data PlainHighlight =
998 PlainHighlight { plainCommon :: Maybe CommonHighlight
999 PlainHighlight { plainCommon :: Maybe CommonHighlight
999− , plainNonPost :: Maybe NonPostings } deriving (Show, Eq, Generic, Typeable)
1000+ , plainNonPost :: Maybe NonPostings } deriving (Read, Show, Eq, Generic, Typeable)
1001 -- This requires that index_options are set to 'offset' in the mapping.
1002 -- This requires that index_options are set to 'offset' in the mapping.
1002−data PostingsHighlight = PostingsHighlight (Maybe CommonHighlight) deriving (Show, Eq, Generic, Typeable)
1003+data PostingsHighlight = PostingsHighlight (Maybe CommonHighlight) deriving (Read, Show, Eq, Generic, Typeable)
1004-- This requires that term_vector is set to 'with_positions_offsets' in the mapping.
1005-- This requires that term_vector is set to 'with_positions_offsets' in the mapping.
1005data FastVectorHighlight =
1006data FastVectorHighlight =
@@ -1010,7 +1011,7 @@ data FastVectorHighlight =
1010 , fragmentOffset :: Maybe Int
1011 , fragmentOffset :: Maybe Int
1011 , matchedFields :: [Text]
1012 , matchedFields :: [Text]
1012 , phraseLimit :: Maybe Int
1013 , phraseLimit :: Maybe Int
1013− } deriving (Show, Eq, Generic, Typeable)
1014+ } deriving (Read, Show, Eq, Generic, Typeable)
1015data CommonHighlight =
1016data CommonHighlight =
1016 CommonHighlight { order :: Maybe Text
1017 CommonHighlight { order :: Maybe Text
@@ -1020,21 +1021,21 @@ data CommonHighlight =
1020 , noMatchSize :: Maybe Int
1021 , noMatchSize :: Maybe Int
1021 , highlightQuery :: Maybe Query
1022 , highlightQuery :: Maybe Query
1022 , requireFieldMatch :: Maybe Bool
1023 , requireFieldMatch :: Maybe Bool
1023− } deriving (Show, Eq, Generic, Typeable)
1024+ } deriving (Read, Show, Eq, Generic, Typeable)
1025-- Settings that are only applicable to FastVector and Plain highlighters.
1026-- Settings that are only applicable to FastVector and Plain highlighters.
1026data NonPostings =
1027data NonPostings =
1027 NonPostings { fragmentSize :: Maybe Int
1028 NonPostings { fragmentSize :: Maybe Int
1028− , numberOfFragments :: Maybe Int} deriving (Show, Eq, Generic, Typeable)
1029+ , numberOfFragments :: Maybe Int} deriving (Read, Show, Eq, Generic, Typeable)
1030data HighlightEncoder = DefaultEncoder
1031data HighlightEncoder = DefaultEncoder
1031 | HTMLEncoder
1032 | HTMLEncoder
1032− deriving (Show, Eq, Generic, Typeable)
1033+ deriving (Read, Show, Eq, Generic, Typeable)
1034-- NOTE: Should the tags use some kind of HTML type, rather than Text?
1035-- NOTE: Should the tags use some kind of HTML type, rather than Text?
1035data HighlightTag = TagSchema Text
1036data HighlightTag = TagSchema Text
1036 | CustomTags ([Text], [Text]) -- Only uses more than the first value in the lists if fvh
1037 | CustomTags ([Text], [Text]) -- Only uses more than the first value in the lists if fvh
1037− deriving (Show, Eq, Generic, Typeable)
1038+ deriving (Read, Show, Eq, Generic, Typeable)
1040data Query =
1041data Query =
@@ -1065,19 +1066,19 @@ data Query =
1065 | QuerySimpleQueryStringQuery SimpleQueryStringQuery
1066 | QuerySimpleQueryStringQuery SimpleQueryStringQuery
1066 | QueryRangeQuery RangeQuery
1067 | QueryRangeQuery RangeQuery
1067 | QueryRegexpQuery RegexpQuery
1068 | QueryRegexpQuery RegexpQuery
1068− deriving (Eq, Show, Generic, Typeable)
1069+ deriving (Eq, Read, Show, Generic, Typeable)
1070data RegexpQuery =
1071data RegexpQuery =
1071 RegexpQuery { regexpQueryField :: FieldName
1072 RegexpQuery { regexpQueryField :: FieldName
1072 , regexpQuery :: Regexp
1073 , regexpQuery :: Regexp
1073 , regexpQueryFlags :: RegexpFlags
1074 , regexpQueryFlags :: RegexpFlags
1074 , regexpQueryBoost :: Maybe Boost
1075 , regexpQueryBoost :: Maybe Boost
1075− } deriving (Eq, Show, Generic, Typeable)
1076+ } deriving (Eq, Read, Show, Generic, Typeable)
1077data RangeQuery =
1078data RangeQuery =
1078 RangeQuery { rangeQueryField :: FieldName
1079 RangeQuery { rangeQueryField :: FieldName
1079 , rangeQueryRange :: RangeValue
1080 , rangeQueryRange :: RangeValue
1080− , rangeQueryBoost :: Boost } deriving (Eq, Show, Generic, Typeable)
1081+ , rangeQueryBoost :: Boost } deriving (Eq, Read, Show, Generic, Typeable)
1082mkRangeQuery :: FieldName -> RangeValue -> RangeQuery
1083mkRangeQuery :: FieldName -> RangeValue -> RangeQuery
1083mkRangeQuery f r = RangeQuery f r (Boost 1.0)
1084mkRangeQuery f r = RangeQuery f r (Boost 1.0)
@@ -1091,7 +1092,7 @@ data SimpleQueryStringQuery =
1091 , simpleQueryStringFlags :: Maybe (NonEmpty SimpleQueryFlag)
1092 , simpleQueryStringFlags :: Maybe (NonEmpty SimpleQueryFlag)
1092 , simpleQueryStringLowercaseExpanded :: Maybe LowercaseExpanded
1093 , simpleQueryStringLowercaseExpanded :: Maybe LowercaseExpanded
1093 , simpleQueryStringLocale :: Maybe Locale
1094 , simpleQueryStringLocale :: Maybe Locale
1094− } deriving (Eq, Show, Generic, Typeable)
1095+ } deriving (Eq, Read, Show, Generic, Typeable)
1096data SimpleQueryFlag =
1097data SimpleQueryFlag =
1097 SimpleQueryAll
1098 SimpleQueryAll
@@ -1105,7 +1106,7 @@ data SimpleQueryFlag =
1105 | SimpleQueryWhitespace
1106 | SimpleQueryWhitespace
1106 | SimpleQueryFuzzy
1107 | SimpleQueryFuzzy
1107 | SimpleQueryNear
1108 | SimpleQueryNear
1108− | SimpleQuerySlop deriving (Eq, Show, Generic, Typeable)
1109+ | SimpleQuerySlop deriving (Eq, Read, Show, Generic, Typeable)
1110-- use_dis_max and tie_breaker when fields are plural?
1111-- use_dis_max and tie_breaker when fields are plural?
1111data QueryStringQuery =
1112data QueryStringQuery =
@@ -1127,7 +1128,7 @@ data QueryStringQuery =
1127 , queryStringMinimumShouldMatch :: Maybe MinimumMatch
1128 , queryStringMinimumShouldMatch :: Maybe MinimumMatch
1128 , queryStringLenient :: Maybe Lenient
1129 , queryStringLenient :: Maybe Lenient
1129 , queryStringLocale :: Maybe Locale
1130 , queryStringLocale :: Maybe Locale
1130− } deriving (Eq, Show, Generic, Typeable)
1131+ } deriving (Eq, Read, Show, Generic, Typeable)
1132mkQueryStringQuery :: QueryString -> QueryStringQuery
1133mkQueryStringQuery :: QueryString -> QueryStringQuery
1133mkQueryStringQuery qs =
1134mkQueryStringQuery qs =
@@ -1138,19 +1139,19 @@ mkQueryStringQuery qs =
1138 Nothing Nothing
1139 Nothing Nothing
1140data FieldOrFields = FofField FieldName
1141data FieldOrFields = FofField FieldName
1141− | FofFields (NonEmpty FieldName) deriving (Eq, Show, Generic, Typeable)
1142+ | FofFields (NonEmpty FieldName) deriving (Eq, Read, Show, Generic, Typeable)
1143data PrefixQuery =
1144data PrefixQuery =
1144 PrefixQuery
1145 PrefixQuery
1145 { prefixQueryField :: FieldName
1146 { prefixQueryField :: FieldName
1146 , prefixQueryPrefixValue :: Text
1147 , prefixQueryPrefixValue :: Text
1147− , prefixQueryBoost :: Maybe Boost } deriving (Eq, Show, Generic, Typeable)
1148+ , prefixQueryBoost :: Maybe Boost } deriving (Eq, Read, Show, Generic, Typeable)
1149data NestedQuery =
1150data NestedQuery =
1150 NestedQuery
1151 NestedQuery
1151 { nestedQueryPath :: QueryPath
1152 { nestedQueryPath :: QueryPath
1152 , nestedQueryScoreType :: ScoreType
1153 , nestedQueryScoreType :: ScoreType
1153− , nestedQuery :: Query } deriving (Eq, Show, Generic, Typeable)
1154+ , nestedQuery :: Query } deriving (Eq, Read, Show, Generic, Typeable)
1155data MoreLikeThisFieldQuery =
1156data MoreLikeThisFieldQuery =
1156 MoreLikeThisFieldQuery
1157 MoreLikeThisFieldQuery
@@ -1168,7 +1169,7 @@ data MoreLikeThisFieldQuery =
1168 , moreLikeThisFieldBoostTerms :: Maybe BoostTerms
1169 , moreLikeThisFieldBoostTerms :: Maybe BoostTerms
1169 , moreLikeThisFieldBoost :: Maybe Boost
1170 , moreLikeThisFieldBoost :: Maybe Boost
1170 , moreLikeThisFieldAnalyzer :: Maybe Analyzer
1171 , moreLikeThisFieldAnalyzer :: Maybe Analyzer
1171− } deriving (Eq, Show, Generic, Typeable)
1172+ } deriving (Eq, Read, Show, Generic, Typeable)
1173data MoreLikeThisQuery =
1174data MoreLikeThisQuery =
1174 MoreLikeThisQuery
1175 MoreLikeThisQuery
@@ -1186,32 +1187,32 @@ data MoreLikeThisQuery =
1186 , moreLikeThisBoostTerms :: Maybe BoostTerms
1187 , moreLikeThisBoostTerms :: Maybe BoostTerms
1187 , moreLikeThisBoost :: Maybe Boost
1188 , moreLikeThisBoost :: Maybe Boost
1188 , moreLikeThisAnalyzer :: Maybe Analyzer
1189 , moreLikeThisAnalyzer :: Maybe Analyzer
1189− } deriving (Eq, Show, Generic, Typeable)
1190+ } deriving (Eq, Read, Show, Generic, Typeable)
1191data IndicesQuery =
1192data IndicesQuery =
1192 IndicesQuery
1193 IndicesQuery
1193 { indicesQueryIndices :: [IndexName]
1194 { indicesQueryIndices :: [IndexName]
1194 , indicesQuery :: Query
1195 , indicesQuery :: Query
1195 -- default "all"
1196 -- default "all"
1196− , indicesQueryNoMatch :: Maybe Query } deriving (Eq, Show, Generic, Typeable)
1197+ , indicesQueryNoMatch :: Maybe Query } deriving (Eq, Read, Show, Generic, Typeable)
1198data HasParentQuery =
1199data HasParentQuery =
1199 HasParentQuery
1200 HasParentQuery
1200 { hasParentQueryType :: TypeName
1201 { hasParentQueryType :: TypeName
1201 , hasParentQuery :: Query
1202 , hasParentQuery :: Query
1202− , hasParentQueryScoreType :: Maybe ScoreType } deriving (Eq, Show, Generic, Typeable)
1203+ , hasParentQueryScoreType :: Maybe ScoreType } deriving (Eq, Read, Show, Generic, Typeable)
1204data HasChildQuery =
1205data HasChildQuery =
1205 HasChildQuery
1206 HasChildQuery
1206 { hasChildQueryType :: TypeName
1207 { hasChildQueryType :: TypeName
1207 , hasChildQuery :: Query
1208 , hasChildQuery :: Query
1208− , hasChildQueryScoreType :: Maybe ScoreType } deriving (Eq, Show, Generic, Typeable)
1209+ , hasChildQueryScoreType :: Maybe ScoreType } deriving (Eq, Read, Show, Generic, Typeable)
1210data ScoreType =
1211data ScoreType =
1211 ScoreTypeMax
1212 ScoreTypeMax
1212 | ScoreTypeSum
1213 | ScoreTypeSum
1213 | ScoreTypeAvg
1214 | ScoreTypeAvg
1214− | ScoreTypeNone deriving (Eq, Show, Generic, Typeable)
1215+ | ScoreTypeNone deriving (Eq, Read, Show, Generic, Typeable)
1216data FuzzyQuery =
1217data FuzzyQuery =
1217 FuzzyQuery { fuzzyQueryField :: FieldName
1218 FuzzyQuery { fuzzyQueryField :: FieldName
@@ -1220,7 +1221,7 @@ data FuzzyQuery =
1220 , fuzzyQueryMaxExpansions :: MaxExpansions
1221 , fuzzyQueryMaxExpansions :: MaxExpansions
1221 , fuzzyQueryFuzziness :: Fuzziness
1222 , fuzzyQueryFuzziness :: Fuzziness
1222 , fuzzyQueryBoost :: Maybe Boost
1223 , fuzzyQueryBoost :: Maybe Boost
1223− } deriving (Eq, Show, Generic, Typeable)
1224+ } deriving (Eq, Read, Show, Generic, Typeable)
1225data FuzzyLikeFieldQuery =
1226data FuzzyLikeFieldQuery =
1226 FuzzyLikeFieldQuery
1227 FuzzyLikeFieldQuery
@@ -1233,7 +1234,7 @@ data FuzzyLikeFieldQuery =
1233 , fuzzyLikeFieldPrefixLength :: PrefixLength
1234 , fuzzyLikeFieldPrefixLength :: PrefixLength
1234 , fuzzyLikeFieldBoost :: Boost
1235 , fuzzyLikeFieldBoost :: Boost
1235 , fuzzyLikeFieldAnalyzer :: Maybe Analyzer
1236 , fuzzyLikeFieldAnalyzer :: Maybe Analyzer
1236− } deriving (Eq, Show, Generic, Typeable)
1237+ } deriving (Eq, Read, Show, Generic, Typeable)
1238data FuzzyLikeThisQuery =
1239data FuzzyLikeThisQuery =
1239 FuzzyLikeThisQuery
1240 FuzzyLikeThisQuery
@@ -1245,19 +1246,19 @@ data FuzzyLikeThisQuery =
1245 , fuzzyLikePrefixLength :: PrefixLength
1246 , fuzzyLikePrefixLength :: PrefixLength
1246 , fuzzyLikeBoost :: Boost
1247 , fuzzyLikeBoost :: Boost
1247 , fuzzyLikeAnalyzer :: Maybe Analyzer
1248 , fuzzyLikeAnalyzer :: Maybe Analyzer
1248− } deriving (Eq, Show, Generic, Typeable)
1249+ } deriving (Eq, Read, Show, Generic, Typeable)
1250data FilteredQuery =
1251data FilteredQuery =
1251 FilteredQuery
1252 FilteredQuery
1252 { filteredQuery :: Query
1253 { filteredQuery :: Query
1253− , filteredFilter :: Filter } deriving (Eq, Show, Generic, Typeable)
1254+ , filteredFilter :: Filter } deriving (Eq, Read, Show, Generic, Typeable)
1255data DisMaxQuery =
1256data DisMaxQuery =
1256 DisMaxQuery { disMaxQueries :: [Query]
1257 DisMaxQuery { disMaxQueries :: [Query]
1257 -- default 0.0
1258 -- default 0.0
1258 , disMaxTiebreaker :: Tiebreaker
1259 , disMaxTiebreaker :: Tiebreaker
1259 , disMaxBoost :: Maybe Boost
1260 , disMaxBoost :: Maybe Boost
1260− } deriving (Eq, Show, Generic, Typeable)
1261+ } deriving (Eq, Read, Show, Generic, Typeable)
1262data MatchQuery =
1263data MatchQuery =
1263 MatchQuery { matchQueryField :: FieldName
1264 MatchQuery { matchQueryField :: FieldName
@@ -1269,7 +1270,7 @@ data MatchQuery =
1269 , matchQueryAnalyzer :: Maybe Analyzer
1270 , matchQueryAnalyzer :: Maybe Analyzer
1270 , matchQueryMaxExpansions :: Maybe MaxExpansions
1271 , matchQueryMaxExpansions :: Maybe MaxExpansions
1271 , matchQueryLenient :: Maybe Lenient
1272 , matchQueryLenient :: Maybe Lenient
1272− , matchQueryBoost :: Maybe Boost } deriving (Eq, Show, Generic, Typeable)
1273+ , matchQueryBoost :: Maybe Boost } deriving (Eq, Read, Show, Generic, Typeable)
1274{-| 'mkMatchQuery' is a convenience function that defaults the less common parameters,
1275{-| 'mkMatchQuery' is a convenience function that defaults the less common parameters,
1275 enabling you to provide only the 'FieldName' and 'QueryString' to make a 'MatchQuery'
1276 enabling you to provide only the 'FieldName' and 'QueryString' to make a 'MatchQuery'
@@ -1279,7 +1280,7 @@ mkMatchQuery field query = MatchQuery field query Or ZeroTermsNone Nothing Nothi
1280data MatchQueryType =
1281data MatchQueryType =
1281 MatchPhrase
1282 MatchPhrase
1282− | MatchPhrasePrefix deriving (Eq, Show, Generic, Typeable)
1283+ | MatchPhrasePrefix deriving (Eq, Read, Show, Generic, Typeable)
1284data MultiMatchQuery =
1285data MultiMatchQuery =
1285 MultiMatchQuery { multiMatchQueryFields :: [FieldName]
1286 MultiMatchQuery { multiMatchQueryFields :: [FieldName]
@@ -1291,7 +1292,7 @@ data MultiMatchQuery =
1291 , multiMatchQueryCutoffFrequency :: Maybe CutoffFrequency
1292 , multiMatchQueryCutoffFrequency :: Maybe CutoffFrequency
1292 , multiMatchQueryAnalyzer :: Maybe Analyzer
1293 , multiMatchQueryAnalyzer :: Maybe Analyzer
1293 , multiMatchQueryMaxExpansions :: Maybe MaxExpansions
1294 , multiMatchQueryMaxExpansions :: Maybe MaxExpansions
1294− , multiMatchQueryLenient :: Maybe Lenient } deriving (Eq, Show, Generic, Typeable)
1295+ , multiMatchQueryLenient :: Maybe Lenient } deriving (Eq, Read, Show, Generic, Typeable)
1296{-| 'mkMultiMatchQuery' is a convenience function that defaults the less common parameters,
1297{-| 'mkMultiMatchQuery' is a convenience function that defaults the less common parameters,
1297 enabling you to provide only the list of 'FieldName's and 'QueryString' to
1298 enabling you to provide only the list of 'FieldName's and 'QueryString' to
@@ -1308,7 +1309,7 @@ data MultiMatchQueryType =
1308 | MultiMatchMostFields
1309 | MultiMatchMostFields
1309 | MultiMatchCrossFields
1310 | MultiMatchCrossFields
1310 | MultiMatchPhrase
1311 | MultiMatchPhrase
1311− | MultiMatchPhrasePrefix deriving (Eq, Show, Generic, Typeable)
1312+ | MultiMatchPhrasePrefix deriving (Eq, Read, Show, Generic, Typeable)
1313data BoolQuery =
1314data BoolQuery =
1314 BoolQuery { boolQueryMustMatch :: [Query]
1315 BoolQuery { boolQueryMustMatch :: [Query]
@@ -1317,7 +1318,7 @@ data BoolQuery =
1317 , boolQueryMinimumShouldMatch :: Maybe MinimumMatch
1318 , boolQueryMinimumShouldMatch :: Maybe MinimumMatch
1318 , boolQueryBoost :: Maybe Boost
1319 , boolQueryBoost :: Maybe Boost
1319 , boolQueryDisableCoord :: Maybe DisableCoord
1320 , boolQueryDisableCoord :: Maybe DisableCoord
1320− } deriving (Eq, Show, Generic, Typeable)
1321+ } deriving (Eq, Read, Show, Generic, Typeable)
1322mkBoolQuery :: [Query] -> [Query] -> [Query] -> BoolQuery
1323mkBoolQuery :: [Query] -> [Query] -> [Query] -> BoolQuery
1323mkBoolQuery must mustNot should =
1324mkBoolQuery must mustNot should =
@@ -1326,7 +1327,7 @@ mkBoolQuery must mustNot should =
1326data BoostingQuery =
1327data BoostingQuery =
1327 BoostingQuery { positiveQuery :: Query
1328 BoostingQuery { positiveQuery :: Query
1328 , negativeQuery :: Query
1329 , negativeQuery :: Query
1329− , negativeBoost :: Boost } deriving (Eq, Show, Generic, Typeable)
1330+ , negativeBoost :: Boost } deriving (Eq, Read, Show, Generic, Typeable)
1331data CommonTermsQuery =
1332data CommonTermsQuery =
1332 CommonTermsQuery { commonField :: FieldName
1333 CommonTermsQuery { commonField :: FieldName
@@ -1338,16 +1339,16 @@ data CommonTermsQuery =
1338 , commonBoost :: Maybe Boost
1339 , commonBoost :: Maybe Boost
1339 , commonAnalyzer :: Maybe Analyzer
1340 , commonAnalyzer :: Maybe Analyzer
1340 , commonDisableCoord :: Maybe DisableCoord
1341 , commonDisableCoord :: Maybe DisableCoord
1341− } deriving (Eq, Show, Generic, Typeable)
1342+ } deriving (Eq, Read, Show, Generic, Typeable)
1343data CommonMinimumMatch =
1344data CommonMinimumMatch =
1344 CommonMinimumMatchHighLow MinimumMatchHighLow
1345 CommonMinimumMatchHighLow MinimumMatchHighLow
1345 | CommonMinimumMatch MinimumMatch
1346 | CommonMinimumMatch MinimumMatch
1346− deriving (Eq, Show, Generic, Typeable)
1347+ deriving (Eq, Read, Show, Generic, Typeable)
1348data MinimumMatchHighLow =
1349data MinimumMatchHighLow =
1349 MinimumMatchHighLow { lowFreq :: MinimumMatch
1350 MinimumMatchHighLow { lowFreq :: MinimumMatch
1350− , highFreq :: MinimumMatch } deriving (Eq, Show, Generic, Typeable)
1351+ , highFreq :: MinimumMatch } deriving (Eq, Read, Show, Generic, Typeable)
1352data Filter = AndFilter [Filter] Cache
1353data Filter = AndFilter [Filter] Cache
1353 | OrFilter [Filter] Cache
1354 | OrFilter [Filter] Cache
@@ -1367,36 +1368,36 @@ data Filter = AndFilter [Filter] Cache
1367 | RangeFilter FieldName RangeValue RangeExecution Cache
1368 | RangeFilter FieldName RangeValue RangeExecution Cache
1368 | RegexpFilter FieldName Regexp RegexpFlags CacheName Cache CacheKey
1369 | RegexpFilter FieldName Regexp RegexpFlags CacheName Cache CacheKey
1369 | TermFilter Term Cache
1370 | TermFilter Term Cache
1370− deriving (Eq, Show, Generic, Typeable)
1371+ deriving (Eq, Read, Show, Generic, Typeable)
1372data ZeroTermsQuery = ZeroTermsNone
1373data ZeroTermsQuery = ZeroTermsNone
1373− | ZeroTermsAll deriving (Eq, Show, Generic, Typeable)
1374+ | ZeroTermsAll deriving (Eq, Read, Show, Generic, Typeable)
1375data RangeExecution = RangeExecutionIndex
1376data RangeExecution = RangeExecutionIndex
1376− | RangeExecutionFielddata deriving (Eq, Show, Generic, Typeable)
1377+ | RangeExecutionFielddata deriving (Eq, Read, Show, Generic, Typeable)
1378−newtype Regexp = Regexp Text deriving (Eq, Show, Generic, Typeable, FromJSON)
1379+newtype Regexp = Regexp Text deriving (Eq, Read, Show, Generic, Typeable, FromJSON)
1380data RegexpFlags = AllRegexpFlags
1381data RegexpFlags = AllRegexpFlags
1381 | NoRegexpFlags
1382 | NoRegexpFlags
1382− | SomeRegexpFlags (NonEmpty RegexpFlag) deriving (Eq, Show, Generic, Typeable)
1383+ | SomeRegexpFlags (NonEmpty RegexpFlag) deriving (Eq, Read, Show, Generic, Typeable)
1384data RegexpFlag = AnyString
1385data RegexpFlag = AnyString
1385 | Automaton
1386 | Automaton
1386 | Complement
1387 | Complement
1388 | Intersection
1389 | Intersection
1389− | Interval deriving (Eq, Show, Generic, Typeable)
1390+ | Interval deriving (Eq, Read, Show, Generic, Typeable)
1391−newtype LessThan = LessThan Double deriving (Eq, Show, Generic, Typeable)
1392+newtype LessThan = LessThan Double deriving (Eq, Read, Show, Generic, Typeable)
1392−newtype LessThanEq = LessThanEq Double deriving (Eq, Show, Generic, Typeable)
1393+newtype LessThanEq = LessThanEq Double deriving (Eq, Read, Show, Generic, Typeable)
1393−newtype GreaterThan = GreaterThan Double deriving (Eq, Show, Generic, Typeable)
1394+newtype GreaterThan = GreaterThan Double deriving (Eq, Read, Show, Generic, Typeable)
1394−newtype GreaterThanEq = GreaterThanEq Double deriving (Eq, Show, Generic, Typeable)
1395+newtype GreaterThanEq = GreaterThanEq Double deriving (Eq, Read, Show, Generic, Typeable)
1396−newtype LessThanD = LessThanD UTCTime deriving (Eq, Show, Generic, Typeable)
1397+newtype LessThanD = LessThanD UTCTime deriving (Eq, Read, Show, Generic, Typeable)
1397−newtype LessThanEqD = LessThanEqD UTCTime deriving (Eq, Show, Generic, Typeable)
1398+newtype LessThanEqD = LessThanEqD UTCTime deriving (Eq, Read, Show, Generic, Typeable)
1398−newtype GreaterThanD = GreaterThanD UTCTime deriving (Eq, Show, Generic, Typeable)
1399+newtype GreaterThanD = GreaterThanD UTCTime deriving (Eq, Read, Show, Generic, Typeable)
1399−newtype GreaterThanEqD = GreaterThanEqD UTCTime deriving (Eq, Show, Generic, Typeable)
1400+newtype GreaterThanEqD = GreaterThanEqD UTCTime deriving (Eq, Read, Show, Generic, Typeable)
1401data RangeValue = RangeDateLte LessThanEqD
1402data RangeValue = RangeDateLte LessThanEqD
1402 | RangeDateLt LessThanD
1403 | RangeDateLt LessThanD
@@ -1414,7 +1415,7 @@ data RangeValue = RangeDateLte LessThanEqD
1414 | RangeDoubleGteLte GreaterThanEq LessThanEq
1415 | RangeDoubleGteLte GreaterThanEq LessThanEq
1415 | RangeDoubleGteLt GreaterThanEq LessThan
1416 | RangeDoubleGteLt GreaterThanEq LessThan
1416 | RangeDoubleGtLte GreaterThan LessThanEq
1417 | RangeDoubleGtLte GreaterThan LessThanEq
1417− deriving (Eq, Show, Generic, Typeable)
1418+ deriving (Eq, Read, Show, Generic, Typeable)
1419rangeValueToPair :: RangeValue -> [Pair]
1420rangeValueToPair :: RangeValue -> [Pair]
1420rangeValueToPair rv = case rv of
1421rangeValueToPair rv = case rv of
@@ -1436,33 +1437,33 @@ rangeValueToPair rv = case rv of
1436 RangeDoubleGtLt (GreaterThan l) (LessThan g) -> ["gt" .= l, "lt" .= g]
1437 RangeDoubleGtLt (GreaterThan l) (LessThan g) -> ["gt" .= l, "lt" .= g]
1438data Term = Term { termField :: Text
1439data Term = Term { termField :: Text
1439− , termValue :: Text } deriving (Eq, Show, Generic, Typeable)
1440+ , termValue :: Text } deriving (Eq, Read, Show, Generic, Typeable)
1441data BoolMatch = MustMatch Term Cache
1442data BoolMatch = MustMatch Term Cache
1442 | MustNotMatch Term Cache
1443 | MustNotMatch Term Cache
1443− | ShouldMatch [Term] Cache deriving (Eq, Show, Generic, Typeable)
1444+ | ShouldMatch [Term] Cache deriving (Eq, Read, Show, Generic, Typeable)
1445-- "memory" or "indexed"
1446-- "memory" or "indexed"
1446data GeoFilterType = GeoFilterMemory
1447data GeoFilterType = GeoFilterMemory
1447− | GeoFilterIndexed deriving (Eq, Show, Generic, Typeable)
1448+ | GeoFilterIndexed deriving (Eq, Read, Show, Generic, Typeable)
1449data LatLon = LatLon { lat :: Double
1450data LatLon = LatLon { lat :: Double
1450− , lon :: Double } deriving (Eq, Show, Generic, Typeable)
1451+ , lon :: Double } deriving (Eq, Read, Show, Generic, Typeable)
1452data GeoBoundingBox =
1453data GeoBoundingBox =
1453 GeoBoundingBox { topLeft :: LatLon
1454 GeoBoundingBox { topLeft :: LatLon
1454− , bottomRight :: LatLon } deriving (Eq, Show, Generic, Typeable)
1455+ , bottomRight :: LatLon } deriving (Eq, Read, Show, Generic, Typeable)
1456data GeoBoundingBoxConstraint =
1457data GeoBoundingBoxConstraint =
1457 GeoBoundingBoxConstraint { geoBBField :: FieldName
1458 GeoBoundingBoxConstraint { geoBBField :: FieldName
1458 , constraintBox :: GeoBoundingBox
1459 , constraintBox :: GeoBoundingBox
1459 , bbConstraintcache :: Cache
1460 , bbConstraintcache :: Cache
1460 , geoType :: GeoFilterType
1461 , geoType :: GeoFilterType
1461− } deriving (Eq, Show, Generic, Typeable)
1462+ } deriving (Eq, Read, Show, Generic, Typeable)
1463data GeoPoint =
1464data GeoPoint =
1464 GeoPoint { geoField :: FieldName
1465 GeoPoint { geoField :: FieldName
1465− , latLon :: LatLon} deriving (Eq, Show, Generic, Typeable)
1466+ , latLon :: LatLon} deriving (Eq, Read, Show, Generic, Typeable)
1467data DistanceUnit = Miles
1468data DistanceUnit = Miles
@@ -1472,22 +1473,22 @@ data DistanceUnit = Miles
1472 | Meters
1473 | Meters
1473 | Centimeters
1474 | Centimeters
1474 | Millimeters
1475 | Millimeters
1475− | NauticalMiles deriving (Eq, Show, Generic, Typeable)
1476+ | NauticalMiles deriving (Eq, Read, Show, Generic, Typeable)
1477data DistanceType = Arc
1478data DistanceType = Arc
1478 | SloppyArc -- doesn't exist <1.0
1479 | SloppyArc -- doesn't exist <1.0
1479− | Plane deriving (Eq, Show, Generic, Typeable)
1480+ | Plane deriving (Eq, Read, Show, Generic, Typeable)
1481data OptimizeBbox = OptimizeGeoFilterType GeoFilterType
1482data OptimizeBbox = OptimizeGeoFilterType GeoFilterType
1482− | NoOptimizeBbox deriving (Eq, Show, Generic, Typeable)
1483+ | NoOptimizeBbox deriving (Eq, Read, Show, Generic, Typeable)
1484data Distance =
1485data Distance =
1485 Distance { coefficient :: Double
1486 Distance { coefficient :: Double
1486− , unit :: DistanceUnit } deriving (Eq, Show, Generic, Typeable)
1487+ , unit :: DistanceUnit } deriving (Eq, Read, Show, Generic, Typeable)
1488data DistanceRange =
1489data DistanceRange =
1489 DistanceRange { distanceFrom :: Distance
1490 DistanceRange { distanceFrom :: Distance
1490− , distanceTo :: Distance } deriving (Eq, Show, Generic, Typeable)
1491+ , distanceTo :: Distance } deriving (Eq, Read, Show, Generic, Typeable)
1492data SearchResult a =
1493data SearchResult a =
1493 SearchResult { took :: Int
1494 SearchResult { took :: Int
@@ -1495,16 +1496,16 @@ data SearchResult a =
1495 , shards :: ShardResult
1496 , shards :: ShardResult
1496 , searchHits :: SearchHits a
1497 , searchHits :: SearchHits a
1497 , aggregations :: Maybe AggregationResults
1498 , aggregations :: Maybe AggregationResults
1498− , scrollId :: Maybe ScrollId } deriving (Eq, Show, Generic, Typeable)
1499+ , scrollId :: Maybe ScrollId } deriving (Eq, Read, Show, Generic, Typeable)
1500−newtype ScrollId = ScrollId Text deriving (Eq, Show, Generic, Ord, ToJSON, FromJSON)
1501+newtype ScrollId = ScrollId Text deriving (Eq, Read, Show, Generic, Ord, ToJSON, FromJSON)
1502type Score = Maybe Double
1503type Score = Maybe Double
1504data SearchHits a =
1505data SearchHits a =
1505 SearchHits { hitsTotal :: Int
1506 SearchHits { hitsTotal :: Int
1506 , maxScore :: Score
1507 , maxScore :: Score
1507− , hits :: [Hit a] } deriving (Eq, Show, Generic, Typeable)
1508+ , hits :: [Hit a] } deriving (Eq, Read, Show, Generic, Typeable)
1510instance Monoid (SearchHits a) where
1511instance Monoid (SearchHits a) where
@@ -1519,12 +1520,12 @@ data Hit a =
1519 , hitDocId :: DocId
1520 , hitDocId :: DocId
1520 , hitScore :: Score
1521 , hitScore :: Score
1521 , hitSource :: Maybe a
1522 , hitSource :: Maybe a
1522− , hitHighlight :: Maybe HitHighlight } deriving (Eq, Show, Generic, Typeable)
1523+ , hitHighlight :: Maybe HitHighlight } deriving (Eq, Read, Show, Generic, Typeable)
1524data ShardResult =
1525data ShardResult =
1525 ShardResult { shardTotal :: Int
1526 ShardResult { shardTotal :: Int
1526 , shardsSuccessful :: Int
1527 , shardsSuccessful :: Int
1527− , shardsFailed :: Int } deriving (Eq, Show, Generic, Typeable)
1528+ , shardsFailed :: Int } deriving (Eq, Read, Show, Generic, Typeable)
1529type HitHighlight = M.Map Text [Text]
1530type HitHighlight = M.Map Text [Text]
@@ -1548,25 +1549,25 @@ mkAggregations :: Text -> Aggregation -> Aggregations
1548mkAggregations name aggregation = M.insert name aggregation emptyAggregations
1549mkAggregations name aggregation = M.insert name aggregation emptyAggregations
1550data TermOrder = TermOrder{ termSortField :: Text
1551data TermOrder = TermOrder{ termSortField :: Text
1551− , termSortOrder :: SortOrder } deriving (Eq, Show, Generic, Typeable)
1552+ , termSortOrder :: SortOrder } deriving (Eq, Read, Show, Generic, Typeable)
1553data TermInclusion = TermInclusion Text
1554data TermInclusion = TermInclusion Text
1554− | TermPattern Text Text deriving (Eq, Show, Generic, Typeable)
1555+ | TermPattern Text Text deriving (Eq, Read, Show, Generic, Typeable)
1556data CollectionMode = BreadthFirst
1557data CollectionMode = BreadthFirst
1557− | DepthFirst deriving (Eq, Show, Generic, Typeable)
1558+ | DepthFirst deriving (Eq, Read, Show, Generic, Typeable)
1559data ExecutionHint = Ordinals
1560data ExecutionHint = Ordinals
1560 | GlobalOrdinals
1561 | GlobalOrdinals
1561 | GlobalOrdinalsHash
1562 | GlobalOrdinalsHash
1562 | GlobalOrdinalsLowCardinality
1563 | GlobalOrdinalsLowCardinality
1563− | Map deriving (Eq, Show, Generic, Typeable)
1564+ | Map deriving (Eq, Read, Show, Generic, Typeable)
1565data TimeInterval = Weeks
1566data TimeInterval = Weeks
1568 | Minutes
1569 | Minutes
1569− | Seconds deriving (Eq)
1570+ | Seconds deriving Eq
1571data Interval = Year
1572data Interval = Year
1572 | Quarter
1573 | Quarter
@@ -1576,18 +1577,18 @@ data Interval = Year
1577 | Minute
1578 | Minute
1578 | Second
1579 | Second
1579− | FractionalInterval Float TimeInterval deriving (Eq, Show, Generic, Typeable)
1580+ | FractionalInterval Float TimeInterval deriving (Eq, Read, Show, Generic, Typeable)
1581data Aggregation = TermsAgg TermsAggregation
1582data Aggregation = TermsAgg TermsAggregation
1582 | DateHistogramAgg DateHistogramAggregation
1583 | DateHistogramAgg DateHistogramAggregation
1583 | ValueCountAgg ValueCountAggregation
1584 | ValueCountAgg ValueCountAggregation
1584 | FilterAgg FilterAggregation
1585 | FilterAgg FilterAggregation
1585 | DateRangeAgg DateRangeAggregation
1586 | DateRangeAgg DateRangeAggregation
1586− | MissingAgg MissingAggregation deriving (Eq, Show, Generic, Typeable)
1587+ | MissingAgg MissingAggregation deriving (Eq, Read, Show, Generic, Typeable)
1588data MissingAggregation = MissingAggregation
1589data MissingAggregation = MissingAggregation
1589 { maField :: Text
1590 { maField :: Text
1590− } deriving (Eq, Show, Generic, Typeable)
1591+ } deriving (Eq, Read, Show, Generic, Typeable)
1592data TermsAggregation = TermsAggregation { term :: Either Text Text
1593data TermsAggregation = TermsAggregation { term :: Either Text Text
1593 , termInclude :: Maybe TermInclusion
1594 , termInclude :: Maybe TermInclusion
@@ -1599,7 +1600,7 @@ data TermsAggregation = TermsAggregation { term :: Either Text Text
1599 , termCollectMode :: Maybe CollectionMode
1600 , termCollectMode :: Maybe CollectionMode
1600 , termExecutionHint :: Maybe ExecutionHint
1601 , termExecutionHint :: Maybe ExecutionHint
1601 , termAggs :: Maybe Aggregations
1602 , termAggs :: Maybe Aggregations
1602− } deriving (Eq, Show, Generic, Typeable)
1603+ } deriving (Eq, Read, Show, Generic, Typeable)
1604data DateHistogramAggregation = DateHistogramAggregation { dateField :: FieldName
1605data DateHistogramAggregation = DateHistogramAggregation { dateField :: FieldName
1605 , dateInterval :: Interval
1606 , dateInterval :: Interval
@@ -1610,29 +1611,29 @@ data DateHistogramAggregation = DateHistogramAggregation { dateField :: Fie
1610 , datePreOffset :: Maybe Text
1611 , datePreOffset :: Maybe Text
1611 , datePostOffset :: Maybe Text
1612 , datePostOffset :: Maybe Text
1612 , dateAggs :: Maybe Aggregations
1613 , dateAggs :: Maybe Aggregations
1613− } deriving (Eq, Show, Generic, Typeable)
1614+ } deriving (Eq, Read, Show, Generic, Typeable)
1616data DateRangeAggregation = DateRangeAggregation { draField :: FieldName
1617data DateRangeAggregation = DateRangeAggregation { draField :: FieldName
1617 , draFormat :: Maybe Text
1618 , draFormat :: Maybe Text
1618 , draRanges :: NonEmpty DateRangeAggRange
1619 , draRanges :: NonEmpty DateRangeAggRange
1619− } deriving (Eq, Show, Generic, Typeable)
1620+ } deriving (Eq, Read, Show, Generic, Typeable)
1621data DateRangeAggRange = DateRangeFrom DateMathExpr
1622data DateRangeAggRange = DateRangeFrom DateMathExpr
1622 | DateRangeTo DateMathExpr
1623 | DateRangeTo DateMathExpr
1623− | DateRangeFromAndTo DateMathExpr DateMathExpr deriving (Eq, Show, Generic, Typeable)
1624+ | DateRangeFromAndTo DateMathExpr DateMathExpr deriving (Eq, Read, Show, Generic, Typeable)
1625-- | See <https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#date-math> for more information.
1626-- | See <https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#date-math> for more information.
1626−data DateMathExpr = DateMathExpr DateMathAnchor [DateMathModifier] deriving (Eq, Show, Generic, Typeable)
1627+data DateMathExpr = DateMathExpr DateMathAnchor [DateMathModifier] deriving (Eq, Read, Show, Generic, Typeable)
1629-- | Starting point for a date range. This along with the 'DateMathModifiers' gets you the date ES will start from.
1630-- | Starting point for a date range. This along with the 'DateMathModifiers' gets you the date ES will start from.
1630data DateMathAnchor = DMNow
1631data DateMathAnchor = DMNow
1631− | DMDate Day deriving (Eq, Show, Generic, Typeable)
1632+ | DMDate Day deriving (Eq, Read, Show, Generic, Typeable)
1633data DateMathModifier = AddTime Int DateMathUnit
1634data DateMathModifier = AddTime Int DateMathUnit
1634 | SubtractTime Int DateMathUnit
1635 | SubtractTime Int DateMathUnit
1635− | RoundDownTo DateMathUnit deriving (Eq, Show, Generic, Typeable)
1636+ | RoundDownTo DateMathUnit deriving (Eq, Read, Show, Generic, Typeable)
1637data DateMathUnit = DMYear
1638data DateMathUnit = DMYear
1638 | DMMonth
1639 | DMMonth
@@ -1640,15 +1641,15 @@ data DateMathUnit = DMYear
1641 | DMHour
1642 | DMHour
1642 | DMMinute
1643 | DMMinute
1643− | DMSecond deriving (Eq, Show, Generic, Typeable)
1644+ | DMSecond deriving (Eq, Read, Show, Generic, Typeable)
1645-- | See <https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-valuecount-aggregation.html> for more information.
1646-- | See <https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-valuecount-aggregation.html> for more information.
1646data ValueCountAggregation = FieldValueCount FieldName
1647data ValueCountAggregation = FieldValueCount FieldName
1647− | ScriptValueCount Script deriving (Eq, Show, Generic, Typeable)
1648+ | ScriptValueCount Script deriving (Eq, Read, Show, Generic, Typeable)
1649-- | Single-bucket filter aggregations. See <https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-filter-aggregation.html#search-aggregations-bucket-filter-aggregation> for more information.
1650-- | Single-bucket filter aggregations. See <https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-filter-aggregation.html#search-aggregations-bucket-filter-aggregation> for more information.
1650data FilterAggregation = FilterAggregation { faFilter :: Filter
1651data FilterAggregation = FilterAggregation { faFilter :: Filter
1651− , faAggs :: Maybe Aggregations} deriving (Eq, Show, Generic, Typeable)
1652+ , faAggs :: Maybe Aggregations} deriving (Eq, Read, Show, Generic, Typeable)
1653mkTermsAggregation :: Text -> TermsAggregation
1654mkTermsAggregation :: Text -> TermsAggregation
1654mkTermsAggregation t = TermsAggregation (Left t) Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing
1655mkTermsAggregation t = TermsAggregation (Left t) Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing
@@ -1712,6 +1713,16 @@ instance Show TimeInterval where
1712 show Minutes = "m"
1713 show Minutes = "m"
1713 show Seconds = "s"
1714 show Seconds = "s"
1716+instance Read TimeInterval where
1717+ readPrec = f =<< TR.get
1719+ f 'w' = return Weeks
1720+ f 'd' = return Days
1721+ f 'h' = return Hours
1722+ f 'm' = return Minutes
1723+ f 's' = return Seconds
1724+ f _ = fail "TimeInterval expected one of w, d, h, m, s"
1715instance ToJSON Aggregation where
1726instance ToJSON Aggregation where
1716 toJSON (TermsAgg (TermsAggregation term include exclude order minDocCount size shardSize collectMode executionHint termAggs)) =
1727 toJSON (TermsAgg (TermsAggregation term include exclude order minDocCount size shardSize collectMode executionHint termAggs)) =
1717 omitNulls ["terms" .= omitNulls [ toJSON' term,
1728 omitNulls ["terms" .= omitNulls [ toJSON' term,
@@ -1789,22 +1800,22 @@ class BucketAggregation a where
1789 aggs :: a -> Maybe AggregationResults
1800 aggs :: a -> Maybe AggregationResults
1792−data Bucket a = Bucket { buckets :: [a]} deriving (Show)
1803+data Bucket a = Bucket { buckets :: [a]} deriving (Read, Show)
1794data BucketValue = TextValue Text
1805data BucketValue = TextValue Text
1795 | ScientificValue Scientific
1806 | ScientificValue Scientific
1796− | BoolValue Bool deriving (Show)
1807+ | BoolValue Bool deriving (Read, Show)
1798data MissingResult = MissingResult { missingDocCount :: Int } deriving (Show)
1809data MissingResult = MissingResult { missingDocCount :: Int } deriving (Show)
1800data TermsResult = TermsResult { termKey :: BucketValue
1811data TermsResult = TermsResult { termKey :: BucketValue
1801 , termsDocCount :: Int
1812 , termsDocCount :: Int
1802− , termsAggs :: Maybe AggregationResults } deriving (Show)
1813+ , termsAggs :: Maybe AggregationResults } deriving (Read, Show)
1804data DateHistogramResult = DateHistogramResult { dateKey :: Int
1815data DateHistogramResult = DateHistogramResult { dateKey :: Int
1805 , dateKeyStr :: Maybe Text
1816 , dateKeyStr :: Maybe Text
1806 , dateDocCount :: Int
1817 , dateDocCount :: Int
1807− , dateHistogramAggs :: Maybe AggregationResults } deriving (Show)
1818+ , dateHistogramAggs :: Maybe AggregationResults } deriving (Read, Show)
1809data DateRangeResult = DateRangeResult { dateRangeKey :: Text
1820data DateRangeResult = DateRangeResult { dateRangeKey :: Text
1810 , dateRangeFrom :: Maybe UTCTime
1821 , dateRangeFrom :: Maybe UTCTime
@@ -1812,7 +1823,7 @@ data DateRangeResult = DateRangeResult { dateRangeKey :: Text
1812 , dateRangeTo :: Maybe UTCTime
1823 , dateRangeTo :: Maybe UTCTime
1813 , dateRangeToAsString :: Maybe Text
1824 , dateRangeToAsString :: Maybe Text
1814 , dateRangeDocCount :: Int
1825 , dateRangeDocCount :: Int
1815− , dateRangeAggs :: Maybe AggregationResults } deriving (Show, Eq, Generic, Typeable)
1826+ , dateRangeAggs :: Maybe AggregationResults } deriving (Read, Show, Eq, Generic, Typeable)
1817toTerms :: Text -> AggregationResults -> Maybe (Bucket TermsResult)
1828toTerms :: Text -> AggregationResults -> Maybe (Bucket TermsResult)
1818toTerms = toAggResult
1829toTerms = toAggResult
@@ -3610,7 +3621,7 @@ instance Enum DocVersion where
3610 enumFromThen = boundedEnumFromThen
3621 enumFromThen = boundedEnumFromThen
3612-- | Username type used for HTTP Basic authentication. See 'basicAuthHook'.
3623-- | Username type used for HTTP Basic authentication. See 'basicAuthHook'.
3613−newtype EsUsername = EsUsername { esUsername :: Text } deriving (Show, Eq)
3624+newtype EsUsername = EsUsername { esUsername :: Text } deriving (Read, Show, Eq)
3615-- | Password type used for HTTP Basic authentication. See 'basicAuthHook'.
3626-- | Password type used for HTTP Basic authentication. See 'basicAuthHook'.
3616−newtype EsPassword = EsPassword { esPassword :: Text } deriving (Show, Eq)
3627+newtype EsPassword = EsPassword { esPassword :: Text } deriving (Read, Show, Eq)