git.iko.soy/typeable/bloodhound
on master help sign in
Index flushing, echo silence
commit5c7caa6f81ce073ef952b4d83a34eee2825ba515 authorChris Allen <cma@bitemyapp.com> dateSun 15 Apr 2018, 20:58 (8 years ago) parent2ddaedd
3 files changed+16−2
Makefile+1−1 src/Database/V5/Bloodhound/Client.hs+8−1 tests/V5/Test/Indices.hs+7
Makefile+1−1
@@ -38,7 +38,7 @@ mod-build:
3838 stack build --ghc-options '+RTS -A128M -RTS'
3939
4040echo-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 !"
4242
43437.8-build:
4444 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
2626 -- ** Indices
2727 , createIndex
2828 , createIndexWith
29+ , flushIndex
2930 , deleteIndex
3031 , updateIndexSettings
3132 , getIndexSettings
@@ -534,7 +535,13 @@ createIndexWith updates shards (IndexName indexName) =
534535 )
535536 ]
536537
537−-- | 'deleteIndex' will delete an index given a 'Server', and an 'IndexName'.
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+
544+-- | 'deleteIndex' will delete an index given a 'Server' and an 'IndexName'.
538545--
539546-- >>> _ <- runBH' $ createIndex defaultIndexSettings (IndexName "didimakeanindex")
540547-- >>> response <- runBH' $ deleteIndex (IndexName "didimakeanindex")
tests/V5/Test/Indices.hs+7
@@ -164,3 +164,10 @@ spec = do
164164 _ <- createExampleIndex
165165 resp <- forceMergeIndex (IndexList (testIndex :| [])) defaultForceMergeIndexSettings
166166 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