Copyright | (C) 2014 2018 Chris Allen |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Chris Allen <cma@bitemyapp.com> |
Stability | provisional |
Portability | GHC |
Safe Haskell | None |
Language | Haskell2010 |
Database.Bloodhound.Dynamic.Client
Description
Dynamically route the query depending on the backend.
withFetchedBackendType $ backend -> pitSearch backend index search
Synopsis
- module Database.Bloodhound.Common.Client
- guessBackendType :: NodeInfo -> Maybe BackendType
- withFetchedBackendType :: MonadBH m => (forall (backend :: BackendType). SBackendType backend -> m a) -> m a
- pitSearch :: forall a m (backend :: BackendType). (FromJSON a, MonadBH m) => SBackendType backend -> IndexName -> Search -> m [Hit a]
Documentation
guessBackendType :: NodeInfo -> Maybe BackendType Source #
Try to guess the current BackendType
withFetchedBackendType :: MonadBH m => (forall (backend :: BackendType). SBackendType backend -> m a) -> m a Source #
Fetch the currently running backend and run backend-dependent code
pitSearch :: forall a m (backend :: BackendType). (FromJSON a, MonadBH m) => SBackendType backend -> IndexName -> Search -> m [Hit a] Source #
pitSearch
uses the point in time (PIT) API of elastic, for a given
IndexName
. Requires Elasticsearch >=7.10 or OpenSearch >=2. Note that this will consume the
entire search result set and will be doing O(n) list appends so this may
not be suitable for large result sets. In that case, the point in time API
should be used directly with openPointInTime
and closePointInTime
.
Note that pitSearch
utilizes the search_after
parameter under the hood,
which requires a non-empty sortBody
field in the provided Search
value.
Otherwise, pitSearch
will fail to return all matching documents.
For more information see https://opensearch.org/docs/latest/search-plugins/point-in-time/.