mirror of
https://github.com/typeable/bloodhound.git
synced 2024-12-02 06:30:29 +03:00
sorted version of getInitialScroll for V5 client
This commit is contained in:
parent
2f0676d73c
commit
b7865504e4
@ -55,6 +55,7 @@ module Database.V5.Bloodhound.Client
|
||||
, searchByType
|
||||
, scanSearch
|
||||
, getInitialScroll
|
||||
, getInitialSortedScroll
|
||||
, advanceScroll
|
||||
, refreshIndex
|
||||
, mkSearch
|
||||
@ -955,6 +956,21 @@ getInitialScroll (IndexName indexName) (MappingName mappingName) search' = do
|
||||
resp' <- bindM2 dispatchSearch url (return search)
|
||||
parseEsResponse resp'
|
||||
|
||||
-- | For a given scearch, request a scroll for efficient streaming of
|
||||
-- search results. Combine this with 'advanceScroll' to efficiently
|
||||
-- stream through the full result set. Note that this search respects
|
||||
-- sorting and may be less efficient than 'getInitialScroll'.
|
||||
getInitialSortedScroll ::
|
||||
(FromJSON a, MonadThrow m, MonadBH m) => IndexName ->
|
||||
MappingName ->
|
||||
Search ->
|
||||
m (Either EsError (SearchResult a))
|
||||
getInitialSortedScroll (IndexName indexName) (MappingName mappingName) search = do
|
||||
let url = addQuery params <$> joinPath [indexName, mappingName, "_search"]
|
||||
params = [("scroll", Just "1m")]
|
||||
resp' <- bindM2 dispatchSearch url (return search)
|
||||
parseEsResponse resp'
|
||||
|
||||
scroll' :: (FromJSON a, MonadBH m, MonadThrow m) => Maybe ScrollId ->
|
||||
m ([Hit a], Maybe ScrollId)
|
||||
scroll' Nothing = return ([], Nothing)
|
||||
|
Loading…
Reference in New Issue
Block a user