@@ -97,8 +97,9 @@ mkReplicaCount n
98-- IndexSettings <$> mkShardCount 10 <*> mkReplicaCount 20
98-- IndexSettings <$> mkShardCount 10 <*> mkReplicaCount 20
100−data IndexSettings = IndexSettings { shards :: ShardCount
101+ IndexSettings { indexShards :: ShardCount
101− , replicas :: ReplicaCount } deriving (Show, Generic)
102+ , indexReplicas :: ReplicaCount } deriving (Show)
103instance ToJSON IndexSettings where
104instance ToJSON IndexSettings where
104 toJSON (IndexSettings s r) = object ["settings" .= object ["shards" .= s, "replicas" .= r]]
105 toJSON (IndexSettings s r) = object ["settings" .= object ["shards" .= s, "replicas" .= r]]
@@ -356,8 +357,8 @@ data Term = Term { termField :: Text
356 , termValue :: Text } deriving (Show)
357 , termValue :: Text } deriving (Show)
358instance ToJSON Term where
359instance ToJSON Term where
359− toJSON (Term termField termValue) = object ["term" .= object
360+ toJSON (Term field value) = object ["term" .= object
360− [termField .= termValue]]
361+ [field .= value]]
362data BoolMatch = MustMatch Term
363data BoolMatch = MustMatch Term
363 | MustNotMatch Term
364 | MustNotMatch Term
@@ -402,7 +403,32 @@ data OptimizeBbox = GeoFilterType | NoOptimizeBbox deriving (Show)
403data Distance =
404data Distance =
404 Distance { coefficient :: Double
405 Distance { coefficient :: Double
405− , unit :: DistanceUnits } deriving (Show)
406+ , unit :: DistanceUnits } deriving (Show)
408+data FromJSON a => SearchResults a =
409+ SearchResults { took :: Int
411+ , shards :: ShardResults
412+ , searchHits :: SearchHits a } deriving (Show)
416+data FromJSON a => SearchHits a =
417+ SearchHits { hitsTotal :: Int
419+ , hits :: [Hits a] } deriving (Show)
421+data FromJSON a => Hits a =
422+ Hits { hitsIndex :: IndexName
423+ , hitsType :: MappingName
424+ , hitDocumentID :: DocumentID
426+ , hitSource :: a } deriving (Show)
429+ ShardResults { shardTotal :: Int
430+ , shardsSuccessful :: Int
431+ , shardsFailed :: Int } deriving (Show)
407-- This is turning into a fractal of horror
433-- This is turning into a fractal of horror
408-- data Fuzziness = FDateFuzziness DateFuzziness |
434-- data Fuzziness = FDateFuzziness DateFuzziness |