@@ -2,6 +2,7 @@
2{-# LANGUAGE RecordWildCards #-}
2{-# LANGUAGE RecordWildCards #-}
3{-# LANGUAGE ScopedTypeVariables #-}
3{-# LANGUAGE ScopedTypeVariables #-}
4{-# LANGUAGE TemplateHaskell #-}
4{-# LANGUAGE TemplateHaskell #-}
5+{-# OPTIONS_GHC -fno-warn-orphans #-}
@@ -45,7 +46,7 @@ main = defaultMain $ testGroup "katip-elasticsearch"
45setupSearch :: IO (Scribe, IO ())
46setupSearch :: IO (Scribe, IO ())
46setupSearch = do
47setupSearch = do
47 bh recreateESSchema
48 bh recreateESSchema
48− mkEsScribe defaultEsScribeCfg { essAnnotateTypes = True } svr ixn mn DebugS V3
49+ mkEsScribe defaultEsScribeCfg { essAnnotateTypes = True, essIndexSettings = ixs } svr ixn mn DebugS V3
51-------------------------------------------------------------------------------
52-------------------------------------------------------------------------------
@@ -62,7 +63,7 @@ esTests setup = testGroup "elasticsearch scribe"
62 testCase "it flushes to elasticsearch" $ withTestLogging setup $ \done -> do
63 testCase "it flushes to elasticsearch" $ withTestLogging setup $ \done -> do
63 $(logT) (ExampleCtx True) mempty InfoS "A test message"
64 $(logT) (ExampleCtx True) mempty InfoS "A test message"
64 liftIO $ do
65 liftIO $ do
66 logs <- getLogs
67 logs <- getLogs
67 length logs @?= 1
68 length logs @?= 1
68 let l = head logs
69 let l = head logs
@@ -168,7 +169,8 @@ ixn = IndexName "katip-elasticsearch-tests"
169-------------------------------------------------------------------------------
170-------------------------------------------------------------------------------
170ixs :: IndexSettings
171ixs :: IndexSettings
171−ixs = defaultIndexSettings
172+ixs = defaultIndexSettings { indexShards = ShardCount 1
173+ , indexReplicas = ReplicaCount 1}
173-------------------------------------------------------------------------------
175-------------------------------------------------------------------------------
174mn :: MappingName
176mn :: MappingName
@@ -181,7 +183,7 @@ mapping = () -- ehhh
183-------------------------------------------------------------------------------
185-------------------------------------------------------------------------------
184−recreateESSchema :: BH IO Reply
186+recreateESSchema :: BH IO ()
185recreateESSchema = dropESSchema >> createESSchema
187recreateESSchema = dropESSchema >> createESSchema
@@ -191,9 +193,9 @@ dropESSchema = void $ deleteIndex ixn
193-------------------------------------------------------------------------------
195-------------------------------------------------------------------------------
194−createESSchema :: BH IO Reply
196+createESSchema :: BH IO ()
195−createESSchema = do
197+createESSchema = void $ do
196− createIndex ixs ixn
198+ void $ createIndex ixs ixn
197 putMapping ixn mn mapping
199 putMapping ixn mn mapping