@@ -77,12 +77,12 @@ import Database.Bloodhound.Types
7777-- >>> import Database.Bloodhound
7878-- >>> import Test.DocTest.Prop (assert)
7979-- >>> let testServer = (Server "http://localhost:9200")
80−-- >>> let runBH = withBH defaultManagerSettings testServer
80+-- >>> let runBH' = withBH defaultManagerSettings testServer
8181-- >>> let testIndex = IndexName "twitter"
8282-- >>> let testMapping = MappingName "tweet"
8383-- >>> let defaultIndexSettings = IndexSettings (ShardCount 3) (ReplicaCount 2)
8484-- >>> data TweetMapping = TweetMapping deriving (Eq, Show)
85−-- >>> _ <- runBH $ deleteIndex testIndex >> deleteMapping testIndex testMapping
85+-- >>> _ <- runBH' $ deleteIndex testIndex >> deleteMapping testIndex testMapping
8686-- >>> import GHC.Generics
8787-- >>> import Data.Time.Calendar (Day (..))
8888-- >>> import Data.Time.Clock (UTCTime (..), secondsToDiffTime)
@@ -192,7 +192,7 @@ post = dispatch NHTM.methodPost
192192
193193-- | 'getStatus' fetches the 'Status' of a 'Server'
194194--
195−-- >>> serverStatus <- runBH getStatus
195+-- >>> serverStatus <- runBH' getStatus
196196-- >>> fmap status (serverStatus)
197197-- Just 200
198198getStatus :: MonadBH m => m (Maybe Status)
@@ -205,10 +205,10 @@ getStatus = do
205205
206206-- | 'createIndex' will create an index given a 'Server', 'IndexSettings', and an 'IndexName'.
207207--
208−-- >>> response <- runBH $ createIndex defaultIndexSettings (IndexName "didimakeanindex")
208+-- >>> response <- runBH' $ createIndex defaultIndexSettings (IndexName "didimakeanindex")
209209-- >>> respIsTwoHunna response
210210-- True
211−-- >>> runBH $ indexExists (IndexName "didimakeanindex")
211+-- >>> runBH' $ indexExists (IndexName "didimakeanindex")
212212-- True
213213createIndex :: MonadBH m => IndexSettings -> IndexName -> m Reply
214214createIndex indexSettings (IndexName indexName) =
@@ -218,11 +218,11 @@ createIndex indexSettings (IndexName indexName) =
218218
219219-- | 'deleteIndex' will delete an index given a 'Server', and an 'IndexName'.
220220--
221−-- >>> _ <- runBH $ createIndex defaultIndexSettings (IndexName "didimakeanindex")
222−-- >>> response <- runBH $ deleteIndex (IndexName "didimakeanindex")
221+-- >>> _ <- runBH' $ createIndex defaultIndexSettings (IndexName "didimakeanindex")
222+-- >>> response <- runBH' $ deleteIndex (IndexName "didimakeanindex")
223223-- >>> respIsTwoHunna response
224224-- True
225−-- >>> runBH $ indexExists testIndex
225+-- >>> runBH' $ indexExists testIndex
226226-- False
227227deleteIndex :: MonadBH m => IndexName -> m Reply
228228deleteIndex (IndexName indexName) =
@@ -242,7 +242,7 @@ existentialQuery url = do
242242-- | 'indexExists' enables you to check if an index exists. Returns 'Bool'
243243-- in IO
244244--
245−-- >>> exists <- runBH $ indexExists testIndex
245+-- >>> exists <- runBH' $ indexExists testIndex
246246indexExists :: MonadBH m => IndexName -> m Bool
247247indexExists (IndexName indexName) = do
248248 (_, exists) <- existentialQuery =<< joinPath [indexName]
@@ -251,8 +251,8 @@ indexExists (IndexName indexName) = do
251251-- | 'refreshIndex' will force a refresh on an index. You must
252252-- do this if you want to read what you wrote.
253253--
254−-- >>> _ <- runBH $ createIndex defaultIndexSettings testIndex
255−-- >>> _ <- runBH $ refreshIndex testIndex
254+-- >>> _ <- runBH' $ createIndex defaultIndexSettings testIndex
255+-- >>> _ <- runBH' $ refreshIndex testIndex
256256refreshIndex :: MonadBH m => IndexName -> m Reply
257257refreshIndex (IndexName indexName) =
258258 bindM2 post url (return Nothing)
@@ -272,22 +272,22 @@ openOrCloseIndexes oci (IndexName indexName) =
272272-- | 'openIndex' opens an index given a 'Server' and an 'IndexName'. Explained in further detail at
273273-- <http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-open-close.html>
274274--
275−-- >>> reply <- runBH $ openIndex testIndex
275+-- >>> reply <- runBH' $ openIndex testIndex
276276openIndex :: MonadBH m => IndexName -> m Reply
277277openIndex = openOrCloseIndexes OpenIndex
278278
279279-- | 'closeIndex' closes an index given a 'Server' and an 'IndexName'. Explained in further detail at
280280-- <http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-open-close.html>
281281--
282−-- >>> reply <- runBH $ closeIndex testIndex
282+-- >>> reply <- runBH' $ closeIndex testIndex
283283closeIndex :: MonadBH m => IndexName -> m Reply
284284closeIndex = openOrCloseIndexes CloseIndex
285285
286286-- | 'putMapping' is an HTTP PUT and has upsert semantics. Mappings are schemas
287287-- for documents in indexes.
288288--
289−-- >>> _ <- runBH $ createIndex defaultIndexSettings testIndex
290−-- >>> resp <- runBH $ putMapping testIndex testMapping TweetMapping
289+-- >>> _ <- runBH' $ createIndex defaultIndexSettings testIndex
290+-- >>> resp <- runBH' $ putMapping testIndex testMapping TweetMapping
291291-- >>> print resp
292292-- Response {responseStatus = Status {statusCode = 200, statusMessage = "OK"}, responseVersion = HTTP/1.1, responseHeaders = [("Content-Type","application/json; charset=UTF-8"),("Content-Length","21")], responseBody = "{\"acknowledged\":true}", responseCookieJar = CJ {expose = []}, responseClose' = ResponseClose}
293293putMapping :: (MonadBH m, ToJSON a) => IndexName
@@ -300,9 +300,9 @@ putMapping (IndexName indexName) (MappingName mappingName) mapping =
300300-- | 'deleteMapping' is an HTTP DELETE and deletes a mapping for a given index.
301301-- Mappings are schemas for documents in indexes.
302302--
303−-- >>> _ <- runBH $ createIndex defaultIndexSettings testIndex
304−-- >>> _ <- runBH $ putMapping testIndex testMapping TweetMapping
305−-- >>> resp <- runBH $ deleteMapping testIndex testMapping
303+-- >>> _ <- runBH' $ createIndex defaultIndexSettings testIndex
304+-- >>> _ <- runBH' $ putMapping testIndex testMapping TweetMapping
305+-- >>> resp <- runBH' $ deleteMapping testIndex testMapping
306306-- >>> print resp
307307-- Response {responseStatus = Status {statusCode = 200, statusMessage = "OK"}, responseVersion = HTTP/1.1, responseHeaders = [("Content-Type","application/json; charset=UTF-8"),("Content-Length","21")], responseBody = "{\"acknowledged\":true}", responseCookieJar = CJ {expose = []}, responseClose' = ResponseClose}
308308deleteMapping :: MonadBH m => IndexName -> MappingName -> m Reply
@@ -315,7 +315,7 @@ deleteMapping (IndexName indexName)
315315-- convert into a JSON 'Value'. The 'DocId' will function as the
316316-- primary key for the document.
317317--
318−-- >>> resp <- runBH $ indexDocument testIndex testMapping exampleTweet (DocId "1")
318+-- >>> resp <- runBH' $ indexDocument testIndex testMapping exampleTweet (DocId "1")
319319-- >>> print resp
320320-- Response {responseStatus = Status {statusCode = 201, statusMessage = "Created"}, responseVersion = HTTP/1.1, responseHeaders = [("Content-Type","application/json; charset=UTF-8"),("Content-Length","74")], responseBody = "{\"_index\":\"twitter\",\"_type\":\"tweet\",\"_id\":\"1\",\"_version\":1,\"created\":true}", responseCookieJar = CJ {expose = []}, responseClose' = ResponseClose}
321321indexDocument :: (ToJSON doc, MonadBH m) => IndexName -> MappingName
@@ -328,7 +328,7 @@ indexDocument (IndexName indexName)
328328
329329-- | 'deleteDocument' is the primary way to delete a single document.
330330--
331−-- >>> _ <- runBH $ deleteDocument testIndex testMapping (DocId "1")
331+-- >>> _ <- runBH' $ deleteDocument testIndex testMapping (DocId "1")
332332deleteDocument :: MonadBH m => IndexName -> MappingName
333333 -> DocId -> m Reply
334334deleteDocument (IndexName indexName)
@@ -343,8 +343,8 @@ deleteDocument (IndexName indexName)
343343-- server to be performed. I changed from [BulkOperation] to a Vector due to memory overhead.
344344--
345345-- >>> let stream = V.fromList [BulkIndex testIndex testMapping (DocId "2") (toJSON (BulkTest "blah"))]
346−-- >>> _ <- runBH $ bulk stream
347−-- >>> _ <- runBH $ refreshIndex testIndex
346+-- >>> _ <- runBH' $ bulk stream
347+-- >>> _ <- runBH' $ refreshIndex testIndex
348348bulk :: MonadBH m => V.Vector BulkOperation -> m Reply
349349bulk bulkOps = bindM2 post url (return body)
350350 where url = joinPath ["_bulk"]
@@ -408,7 +408,7 @@ encodeBulkOperation (BulkUpdate (IndexName indexName)
408408-- Elasticsearch using a 'Server', 'IndexName', 'MappingName', and a 'DocId'.
409409-- The 'DocId' is the primary key for your Elasticsearch document.
410410--
411−-- >>> yourDoc <- runBH $ getDocument testIndex testMapping (DocId "1")
411+-- >>> yourDoc <- runBH' $ getDocument testIndex testMapping (DocId "1")
412412getDocument :: MonadBH m => IndexName -> MappingName
413413 -> DocId -> m Reply
414414getDocument (IndexName indexName)
@@ -418,7 +418,7 @@ getDocument (IndexName indexName)
418418-- | 'documentExists' enables you to check if a document exists. Returns 'Bool'
419419-- in IO
420420--
421−-- >>> exists <- runBH $ documentExists testIndex testMapping (DocId "1")
421+-- >>> exists <- runBH' $ documentExists testIndex testMapping (DocId "1")
422422documentExists :: MonadBH m => IndexName -> MappingName
423423 -> DocId -> m Bool
424424documentExists (IndexName indexName)
@@ -435,7 +435,7 @@ dispatchSearch url search = post url (Just (encode search))
435435--
436436-- >>> let query = TermQuery (Term "user" "bitemyapp") Nothing
437437-- >>> let search = mkSearch (Just query) Nothing
438−-- >>> reply <- runBH $ searchAll search
438+-- >>> reply <- runBH' $ searchAll search
439439searchAll :: MonadBH m => Search -> m Reply
440440searchAll = bindM2 dispatchSearch url . return
441441 where url = joinPath ["_search"]
@@ -445,7 +445,7 @@ searchAll = bindM2 dispatchSearch url . return
445445--
446446-- >>> let query = TermQuery (Term "user" "bitemyapp") Nothing
447447-- >>> let search = mkSearch (Just query) Nothing
448−-- >>> reply <- runBH $ searchByIndex testIndex search
448+-- >>> reply <- runBH' $ searchByIndex testIndex search
449449searchByIndex :: MonadBH m => IndexName -> Search -> m Reply
450450searchByIndex (IndexName indexName) = bindM2 dispatchSearch url . return
451451 where url = joinPath [indexName, "_search"]
@@ -455,7 +455,7 @@ searchByIndex (IndexName indexName) = bindM2 dispatchSearch url . return
455455--
456456-- >>> let query = TermQuery (Term "user" "bitemyapp") Nothing
457457-- >>> let search = mkSearch (Just query) Nothing
458−-- >>> reply <- runBH $ searchByType testIndex testMapping search
458+-- >>> reply <- runBH' $ searchByType testIndex testMapping search
459459searchByType :: MonadBH m => IndexName -> MappingName -> Search
460460 -> m Reply
461461searchByType (IndexName indexName)