@@ -97,8 +97,9 @@ mkReplicaCount n
9797
9898-- IndexSettings <$> mkShardCount 10 <*> mkReplicaCount 20
9999
100−data IndexSettings = IndexSettings { shards :: ShardCount
101− , replicas :: ReplicaCount } deriving (Show, Generic)
100+data IndexSettings =
101+ IndexSettings { indexShards :: ShardCount
102+ , indexReplicas :: ReplicaCount } deriving (Show)
102103
103104instance ToJSON IndexSettings where
104105 toJSON (IndexSettings s r) = object ["settings" .= object ["shards" .= s, "replicas" .= r]]
@@ -356,8 +357,8 @@ data Term = Term { termField :: Text
356357 , termValue :: Text } deriving (Show)
357358
358359instance ToJSON Term where
359− toJSON (Term termField termValue) = object ["term" .= object
360− [termField .= termValue]]
360+ toJSON (Term field value) = object ["term" .= object
361+ [field .= value]]
361362
362363data BoolMatch = MustMatch Term
363364 | MustNotMatch Term
@@ -402,7 +403,32 @@ data OptimizeBbox = GeoFilterType | NoOptimizeBbox deriving (Show)
402403
403404data Distance =
404405 Distance { coefficient :: Double
405− , unit :: DistanceUnits } deriving (Show)
406+ , unit :: DistanceUnits } deriving (Show)
407+
408+data FromJSON a => SearchResults a =
409+ SearchResults { took :: Int
410+ , timedOut :: Bool
411+ , shards :: ShardResults
412+ , searchHits :: SearchHits a } deriving (Show)
413+
414+type Score = Double
415+
416+data FromJSON a => SearchHits a =
417+ SearchHits { hitsTotal :: Int
418+ , maxScore :: Score
419+ , hits :: [Hits a] } deriving (Show)
420+
421+data FromJSON a => Hits a =
422+ Hits { hitsIndex :: IndexName
423+ , hitsType :: MappingName
424+ , hitDocumentID :: DocumentID
425+ , hitScore :: Score
426+ , hitSource :: a } deriving (Show)
427+
428+data ShardResults =
429+ ShardResults { shardTotal :: Int
430+ , shardsSuccessful :: Int
431+ , shardsFailed :: Int } deriving (Show)
406432
407433-- This is turning into a fractal of horror
408434-- data Fuzziness = FDateFuzziness DateFuzziness |