git.iko.soy/typeable/bloodhound
on master help sign in
Index flushing, echo silence
5c7caa6Chris Allen
Makefile+1−1
@@ -38,7 +38,7 @@ mod-build:
38 stack build --ghc-options '+RTS -A128M -RTS'
38 stack build --ghc-options '+RTS -A128M -RTS'
39
39
40echo-warn:
40echo-warn:
41− echo "Make certain you have an elasticsearch instance on localhost:9200 !"
41+ @echo "Make certain you have an elasticsearch instance on localhost:9200 !"
42
42
437.8-build:
437.8-build:
44 STACK_YAML="stack-7.8.yaml" stack build
44 STACK_YAML="stack-7.8.yaml" stack build
src/Database/V5/Bloodhound/Client.hs+8−1
@@ -26,6 +26,7 @@ module Database.V5.Bloodhound.Client
26 -- ** Indices
26 -- ** Indices
27 , createIndex
27 , createIndex
28 , createIndexWith
28 , createIndexWith
29+ , flushIndex
29 , deleteIndex
30 , deleteIndex
30 , updateIndexSettings
31 , updateIndexSettings
31 , getIndexSettings
32 , getIndexSettings
@@ -534,7 +535,13 @@ createIndexWith updates shards (IndexName indexName) =
534 )
535 )
535 ]
536 ]
536
537
538+-- | 'flushIndex' will flush an index given a 'Server' and an 'IndexName'.
539+flushIndex :: MonadBH m => IndexName -> m Reply
540+flushIndex (IndexName indexName) = do
541+ path <- joinPath [indexName, "_flush"]
542+ post path Nothing
543+
537−-- | 'deleteIndex' will delete an index given a 'Server', and an 'IndexName'.
544+-- | 'deleteIndex' will delete an index given a 'Server' and an 'IndexName'.
538--
545--
539-- >>> _ <- runBH' $ createIndex defaultIndexSettings (IndexName "didimakeanindex")
546-- >>> _ <- runBH' $ createIndex defaultIndexSettings (IndexName "didimakeanindex")
540-- >>> response <- runBH' $ deleteIndex (IndexName "didimakeanindex")
547-- >>> response <- runBH' $ deleteIndex (IndexName "didimakeanindex")
tests/V5/Test/Indices.hs+7
@@ -164,3 +164,10 @@ spec = do
164 _ <- createExampleIndex
164 _ <- createExampleIndex
165 resp <- forceMergeIndex (IndexList (testIndex :| [])) defaultForceMergeIndexSettings
165 resp <- forceMergeIndex (IndexList (testIndex :| [])) defaultForceMergeIndexSettings
166 liftIO $ validateStatus resp 200
166 liftIO $ validateStatus resp 200
167+
168+
169+ describe "Index flushing" $ do
170+ it "returns a successful response upon flushing" $ withTestEnv $ do
171+ _ <- createExampleIndex
172+ resp <- flushIndex testIndex
173+ liftIO $ validateStatus resp 200