Index flushing, echo silence

This commit is contained in:
Chris Allen 2018-04-15 20:58:15 -05:00
parent 2ddaedd05e
commit 5c7caa6f81
3 changed files with 16 additions and 2 deletions

View File

@ -38,7 +38,7 @@ mod-build:
stack build --ghc-options '+RTS -A128M -RTS'
echo-warn:
echo "Make certain you have an elasticsearch instance on localhost:9200 !"
@echo "Make certain you have an elasticsearch instance on localhost:9200 !"
7.8-build:
STACK_YAML="stack-7.8.yaml" stack build

View File

@ -26,6 +26,7 @@ module Database.V5.Bloodhound.Client
-- ** Indices
, createIndex
, createIndexWith
, flushIndex
, deleteIndex
, updateIndexSettings
, getIndexSettings
@ -534,7 +535,13 @@ createIndexWith updates shards (IndexName indexName) =
)
]
-- | 'deleteIndex' will delete an index given a 'Server', and an 'IndexName'.
-- | 'flushIndex' will flush an index given a 'Server' and an 'IndexName'.
flushIndex :: MonadBH m => IndexName -> m Reply
flushIndex (IndexName indexName) = do
path <- joinPath [indexName, "_flush"]
post path Nothing
-- | 'deleteIndex' will delete an index given a 'Server' and an 'IndexName'.
--
-- >>> _ <- runBH' $ createIndex defaultIndexSettings (IndexName "didimakeanindex")
-- >>> response <- runBH' $ deleteIndex (IndexName "didimakeanindex")

View File

@ -164,3 +164,10 @@ spec = do
_ <- createExampleIndex
resp <- forceMergeIndex (IndexList (testIndex :| [])) defaultForceMergeIndexSettings
liftIO $ validateStatus resp 200
describe "Index flushing" $ do
it "returns a successful response upon flushing" $ withTestEnv $ do
_ <- createExampleIndex
resp <- flushIndex testIndex
liftIO $ validateStatus resp 200