bloodhound-0.16.0.0: Elasticsearch client library for Haskell

Safe HaskellNone
LanguageHaskell2010

Database.V5.Bloodhound.Internal.Client

Synopsis

Documentation

data BHEnv Source #

Common environment for Elasticsearch calls. Connections will be pipelined according to the provided HTTP connection manager.

Constructors

BHEnv 

Fields

newtype Server Source #

Server is used with the client functions to point at the ES instance

Constructors

Server Text 

class (Functor m, Applicative m, MonadIO m) => MonadBH m where Source #

All API calls to Elasticsearch operate within MonadBH . The idea is that it can be easily embedded in your own monad transformer stack. A default instance for a ReaderT and alias BH is provided for the simple case.

Minimal complete definition

getBHEnv

Methods

getBHEnv :: m BHEnv Source #

mkBHEnv :: Server -> Manager -> BHEnv Source #

Create a BHEnv with all optional fields defaulted. HTTP hook will be a noop. You can use the exported fields to customize it further, e.g.:

> (mkBHEnv myServer myManager) { bhRequestHook = customHook }

newtype BH m a Source #

Constructors

BH 

Fields

Instances

MonadTrans BH Source # 

Methods

lift :: Monad m => m a -> BH m a #

MonadWriter w m => MonadWriter w (BH m) Source # 

Methods

writer :: (a, w) -> BH m a #

tell :: w -> BH m () #

listen :: BH m a -> BH m (a, w) #

pass :: BH m (a, w -> w) -> BH m a #

MonadState s m => MonadState s (BH m) Source # 

Methods

get :: BH m s #

put :: s -> BH m () #

state :: (s -> (a, s)) -> BH m a #

MonadReader r m => MonadReader r (BH m) Source # 

Methods

ask :: BH m r #

local :: (r -> r) -> BH m a -> BH m a #

reader :: (r -> a) -> BH m a #

MonadError e m => MonadError e (BH m) Source # 

Methods

throwError :: e -> BH m a #

catchError :: BH m a -> (e -> BH m a) -> BH m a #

Monad m => Monad (BH m) Source # 

Methods

(>>=) :: BH m a -> (a -> BH m b) -> BH m b #

(>>) :: BH m a -> BH m b -> BH m b #

return :: a -> BH m a #

fail :: String -> BH m a #

Functor m => Functor (BH m) Source # 

Methods

fmap :: (a -> b) -> BH m a -> BH m b #

(<$) :: a -> BH m b -> BH m a #

MonadFix m => MonadFix (BH m) Source # 

Methods

mfix :: (a -> BH m a) -> BH m a #

Applicative m => Applicative (BH m) Source # 

Methods

pure :: a -> BH m a #

(<*>) :: BH m (a -> b) -> BH m a -> BH m b #

liftA2 :: (a -> b -> c) -> BH m a -> BH m b -> BH m c #

(*>) :: BH m a -> BH m b -> BH m b #

(<*) :: BH m a -> BH m b -> BH m a #

Alternative m => Alternative (BH m) Source # 

Methods

empty :: BH m a #

(<|>) :: BH m a -> BH m a -> BH m a #

some :: BH m a -> BH m [a] #

many :: BH m a -> BH m [a] #

MonadPlus m => MonadPlus (BH m) Source # 

Methods

mzero :: BH m a #

mplus :: BH m a -> BH m a -> BH m a #

MonadIO m => MonadIO (BH m) Source # 

Methods

liftIO :: IO a -> BH m a #

MonadThrow m => MonadThrow (BH m) Source # 

Methods

throwM :: Exception e => e -> BH m a #

MonadCatch m => MonadCatch (BH m) Source # 

Methods

catch :: Exception e => BH m a -> (e -> BH m a) -> BH m a #

MonadMask m => MonadMask (BH m) Source # 

Methods

mask :: ((forall a. BH m a -> BH m a) -> BH m b) -> BH m b #

uninterruptibleMask :: ((forall a. BH m a -> BH m a) -> BH m b) -> BH m b #

generalBracket :: BH m a -> (a -> ExitCase b -> BH m c) -> (a -> BH m b) -> BH m (b, c) #

(Functor m, Applicative m, MonadIO m) => MonadBH (BH m) Source # 

Methods

getBHEnv :: BH m BHEnv Source #

runBH :: BHEnv -> BH m a -> m a Source #

data Status Source #

Status is a data type for describing the JSON body returned by Elasticsearch when you query its status. This was deprecated in 1.2.0.

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-status.html#indices-status

Constructors

Status 

data ForceMergeIndexSettings Source #

Constructors

ForceMergeIndexSettings 

Fields

  • maxNumSegments :: Maybe Int

    Number of segments to optimize to. 1 will fully optimize the index. If omitted, the default behavior is to only optimize if the server deems it necessary.

  • onlyExpungeDeletes :: Bool

    Should the optimize process only expunge segments with deletes in them? If the purpose of the optimization is to free disk space, this should be set to True.

  • flushAfterOptimize :: Bool

    Should a flush be performed after the optimize.

defaultForceMergeIndexSettings :: ForceMergeIndexSettings Source #

defaultForceMergeIndexSettings implements the default settings that Elasticsearch uses for index optimization. maxNumSegments is Nothing, onlyExpungeDeletes is False, and flushAfterOptimize is True.

data UpdatableIndexSetting Source #

Constructors

NumberOfReplicas ReplicaCount

The number of replicas each shard has.

AutoExpandReplicas ReplicaBounds 
BlocksReadOnly Bool

Set to True to have the index read only. False to allow writes and metadata changes.

BlocksRead Bool

Set to True to disable read operations against the index.

BlocksWrite Bool

Set to True to disable write operations against the index.

BlocksMetaData Bool

Set to True to disable metadata operations against the index.

RefreshInterval NominalDiffTime

The async refresh interval of a shard

IndexConcurrency Int 
FailOnMergeFailure Bool 
TranslogFlushThresholdOps Int

When to flush on operations.

TranslogFlushThresholdSize Bytes

When to flush based on translog (bytes) size.

TranslogFlushThresholdPeriod NominalDiffTime

When to flush based on a period of not flushing.

TranslogDisableFlush Bool

Disables flushing. Note, should be set for a short interval and then enabled.

CacheFilterMaxSize (Maybe Bytes)

The maximum size of filter cache (per segment in shard).

CacheFilterExpire (Maybe NominalDiffTime)

The expire after access time for filter cache.

GatewaySnapshotInterval NominalDiffTime

The gateway snapshot interval (only applies to shared gateways).

RoutingAllocationInclude (NonEmpty NodeAttrFilter)

A node matching any rule will be allowed to host shards from the index.

RoutingAllocationExclude (NonEmpty NodeAttrFilter)

A node matching any rule will NOT be allowed to host shards from the index.

RoutingAllocationRequire (NonEmpty NodeAttrFilter)

Only nodes matching all rules will be allowed to host shards from the index.

RoutingAllocationEnable AllocationPolicy

Enables shard allocation for a specific index.

RoutingAllocationShardsPerNode ShardCount

Controls the total number of shards (replicas and primaries) allowed to be allocated on a single node.

RecoveryInitialShards InitialShardCount

When using local gateway a particular shard is recovered only if there can be allocated quorum shards in the cluster.

GCDeletes NominalDiffTime 
TTLDisablePurge Bool

Disables temporarily the purge of expired docs.

TranslogFSType FSType 
CompressionSetting Compression 
IndexCompoundFormat CompoundFormat 
IndexCompoundOnFlush Bool 
WarmerEnabled Bool 
MappingTotalFieldsLimit Int 
AnalysisSetting Analysis

Analysis is not a dynamic setting and can only be performed on a closed index.

newtype Bytes Source #

A measure of bytes used for various configurations. You may want to use smart constructors like gigabytes for larger values.

>>> gigabytes 9
Bytes 9000000000
>>> megabytes 9
Bytes 9000000
>>> kilobytes 9
Bytes 9000

Constructors

Bytes Int 

type Reply = Response LByteString Source #

Reply and Method are type synonyms from Method

data IndexTemplate Source #

An IndexTemplate defines a template that will automatically be applied to new indices created. The templates include both IndexSettings and mappings, and a simple TemplatePattern that controls if the template will be applied to the index created. Specify mappings as follows: [toJSON TweetMapping, ...]

https://www.elastic.co/guide/en/elasticsearch/reference/1.7/indices-templates.html

data Mapping Source #

Support for type reification of Mappings is currently incomplete, for now the mapping API verbiage expects a ToJSONable blob.

Indexes have mappings, mappings are schemas for the documents contained in the index. I'd recommend having only one mapping per index, always having a mapping, and keeping different kinds of documents separated if possible.

Constructors

Mapping 

data AllocationPolicy Source #

Constructors

AllocAll

Allows shard allocation for all shards.

AllocPrimaries

Allows shard allocation only for primary shards.

AllocNewPrimaries

Allows shard allocation only for primary shards for new indices.

AllocNone

No shard allocation is allowed

data BulkOperation Source #

BulkOperation is a sum type for expressing the four kinds of bulk operation index, create, delete, and update. BulkIndex behaves like an "upsert", BulkCreate will fail if a document already exists at the DocId. Consult the Bulk API documentation for further explanation. Warning: Bulk operations suffixed with Auto rely on Elasticsearch to generate the id. Often, people use auto-generated identifiers when Elasticsearch is the only place that their data is stored. Do not let Elasticsearch be the only place your data is stored. It does not guarantee durability, and it may silently discard data. This issue is discussed further on github.

Constructors

BulkIndex IndexName MappingName DocId Value

Create the document, replacing it if it already exists.

BulkIndexAuto IndexName MappingName Value

Create a document with an autogenerated id.

BulkIndexEncodingAuto IndexName MappingName Encoding

Create a document with an autogenerated id. Use fast JSON encoding.

BulkCreate IndexName MappingName DocId Value

Create a document, failing if it already exists.

BulkCreateEncoding IndexName MappingName DocId Encoding

Create a document, failing if it already exists. Use fast JSON encoding.

BulkDelete IndexName MappingName DocId

Delete the document

BulkUpdate IndexName MappingName DocId Value

Update the document, merging the new value with the existing one.

data EsResult a Source #

EsResult describes the standard wrapper JSON document that you see in successful Elasticsearch lookups or lookups that couldn't find the document.

Constructors

EsResult 

Instances

Eq a => Eq (EsResult a) Source # 

Methods

(==) :: EsResult a -> EsResult a -> Bool #

(/=) :: EsResult a -> EsResult a -> Bool #

Show a => Show (EsResult a) Source # 

Methods

showsPrec :: Int -> EsResult a -> ShowS #

show :: EsResult a -> String #

showList :: [EsResult a] -> ShowS #

FromJSON a => FromJSON (EsResult a) Source # 

data EsResultFound a Source #

EsResultFound contains the document and its metadata inside of an EsResult when the document was successfully found.

Constructors

EsResultFound 

Fields

data EsError Source #

EsError is the generic type that will be returned when there was a problem. If you can't parse the expected response, its a good idea to try parsing this.

Constructors

EsError 

data EsProtocolException Source #

EsProtocolException will be thrown if Bloodhound cannot parse a response returned by the Elasticsearch server. If you encounter this error, please verify that your domain data types and FromJSON instances are working properly (for example, the a of '[Hit a]' in 'SearchResult.searchHits.hits'). If you're sure that your mappings are correct, then this error may be an indication of an incompatibility between Bloodhound and Elasticsearch. Please open a bug report and be sure to include the exception body.

Constructors

EsProtocolException 

Fields

newtype DocVersion Source #

DocVersion is an integer version number for a document between 1 and 9.2e+18 used for .

Constructors

DocVersion 

mkDocVersion :: Int -> Maybe DocVersion Source #

Smart constructor for in-range doc version

newtype ExternalDocVersion Source #

ExternalDocVersion is a convenience wrapper if your code uses its own version numbers instead of ones from ES.

Instances

Bounded ExternalDocVersion Source # 
Enum ExternalDocVersion Source # 
Eq ExternalDocVersion Source # 
Ord ExternalDocVersion Source # 
Show ExternalDocVersion Source # 
ToJSON ExternalDocVersion Source # 

data VersionControl Source #

VersionControl is specified when indexing documents as a optimistic concurrency control.

Constructors

NoVersionControl

Don't send a version. This is a pure overwrite.

InternalVersion DocVersion

Use the default ES versioning scheme. Only index the document if the version is the same as the one specified. Only applicable to updates, as you should be getting Version from a search result.

ExternalGT ExternalDocVersion

Use your own version numbering. Only index the document if the version is strictly higher OR the document doesn't exist. The given version will be used as the new version number for the stored document. N.B. All updates must increment this number, meaning there is some global, external ordering of updates.

ExternalGTE ExternalDocVersion

Use your own version numbering. Only index the document if the version is equal or higher than the stored version. Will succeed if there is no existing document. The given version will be used as the new version number for the stored document. Use with care, as this could result in data loss.

ForceVersion ExternalDocVersion

The document will always be indexed and the given version will be the new version. This is typically used for correcting errors. Use with care, as this could result in data loss.

data IndexDocumentSettings Source #

IndexDocumentSettings are special settings supplied when indexing a document. For the best backwards compatiblity when new fields are added, you should probably prefer to start with defaultIndexDocumentSettings

defaultIndexDocumentSettings :: IndexDocumentSettings Source #

Reasonable default settings. Chooses no version control and no parent.

data IndexSelection Source #

IndexSelection is used for APIs which take a single index, a list of indexes, or the special _all index.

data NodeSelection Source #

NodeSelection is used for most cluster APIs. See here for more details.

Constructors

LocalNode

Whatever node receives this request

NodeList (NonEmpty NodeSelector) 
AllNodes 

data NodeSelector Source #

An exact match or pattern to identify a node. Note that All of these options support wildcarding, so your node name, server, attr name can all contain * characters to be a fuzzy match.

Constructors

NodeByName NodeName 
NodeByFullNodeId FullNodeId 
NodeByHost Server

e.g. 10.0.0.1 or even 10.0.0.*

NodeByAttribute NodeAttrName Text

NodeAttrName can be a pattern, e.g. rack*. The value can too.

newtype EsUsername Source #

Username type used for HTTP Basic authentication. See basicAuthHook.

Constructors

EsUsername 

Fields

newtype EsPassword Source #

Password type used for HTTP Basic authentication. See basicAuthHook.

Constructors

EsPassword 

Fields

data SnapshotRepoPattern Source #

Either specifies an exact repo name or one with globs in it, e.g. RepoPattern "foo*" NOTE: Patterns are not supported on ES < 1.7

data GenericSnapshotRepo Source #

A generic representation of a snapshot repo. This is what gets sent to and parsed from the server. For repo types enabled by plugins that aren't exported by this library, consider making a custom type which implements SnapshotRepo. If it is a common repo type, consider submitting a pull request to have it included in the library proper

newtype FullNodeId Source #

Unique, automatically-generated name assigned to nodes that are usually returned in node-oriented APIs.

Constructors

FullNodeId 

Fields

newtype NodeName Source #

A human-readable node name that is supplied by the user in the node config or automatically generated by Elasticsearch.

Constructors

NodeName 

Fields

data NodeThreadPoolsStats Source #

data NodeIndicesStats Source #

Constructors

NodeIndicesStats 

Fields

newtype EsAddress Source #

A quirky address format used throughout Elasticsearch. An example would be inet[/1.1.1.1:9200]. inet may be a placeholder for a FQDN.

Constructors

EsAddress 

Fields

newtype JVMVersion Source #

We cannot parse JVM version numbers and we're not going to try.

Constructors

JVMVersion 

Fields

newtype PID Source #

Constructors

PID 

Fields

Instances

Eq PID Source # 

Methods

(==) :: PID -> PID -> Bool #

(/=) :: PID -> PID -> Bool #

Show PID Source # 

Methods

showsPrec :: Int -> PID -> ShowS #

show :: PID -> String #

showList :: [PID] -> ShowS #

FromJSON PID Source # 

data SnapshotRestoreSettings Source #

Constructors

SnapshotRestoreSettings 

Fields

newtype SnapshotRepoUpdateSettings Source #

Constructors

SnapshotRepoUpdateSettings 

Fields

  • repoUpdateVerify :: Bool

    After creation/update, synchronously check that nodes can write to this repo. Defaults to True. You may use False if you need a faster response and plan on verifying manually later with verifySnapshotRepo.

defaultSnapshotRepoUpdateSettings :: SnapshotRepoUpdateSettings Source #

Reasonable defaults for repo creation/update

  • repoUpdateVerify True

data FsSnapshotRepo Source #

A filesystem-based snapshot repo that ships with Elasticsearch. This is an instance of SnapshotRepo so it can be used with updateSnapshotRepo

Constructors

FsSnapshotRepo 

Fields

data SnapshotCreateSettings Source #

Constructors

SnapshotCreateSettings 

Fields

  • snapWaitForCompletion :: Bool

    Should the API call return immediately after initializing the snapshot or wait until completed? Note that if this is enabled it could wait a long time, so you should adjust your ManagerSettings accordingly to set long timeouts or explicitly handle timeouts.

  • snapIndices :: Maybe IndexSelection

    Nothing will snapshot all indices. Just [] is permissable and will essentially be a no-op snapshot.

  • snapIgnoreUnavailable :: Bool

    If set to True, any matched indices that don't exist will be ignored. Otherwise it will be an error and fail.

  • snapIncludeGlobalState :: Bool
     
  • snapPartial :: Bool

    If some indices failed to snapshot (e.g. if not all primary shards are available), should the process proceed?

defaultSnapshotCreateSettings :: SnapshotCreateSettings Source #

Reasonable defaults for snapshot creation

  • snapWaitForCompletion False
  • snapIndices Nothing
  • snapIgnoreUnavailable False
  • snapIncludeGlobalState True
  • snapPartial False

data SnapshotPattern Source #

Either specifies an exact snapshot name or one with globs in it, e.g. SnapPattern "foo*" NOTE: Patterns are not supported on ES < 1.7

data RestoreRenameToken Source #

A single token in a index renaming scheme for a restore. These are concatenated into a string before being sent to Elasticsearch. Check out these Java docs to find out more if you're into that sort of thing.

Constructors

RRTLit Text

Just a literal string of characters

RRSubWholeMatch

Equivalent to $0. The entire matched pattern, not any subgroup

RRSubGroup RRGroupRefNum

A specific reference to a group number

mkRRGroupRefNum :: Int -> Maybe RRGroupRefNum Source #

Only allows valid group number references (1-9).

defaultSnapshotRestoreSettings :: SnapshotRestoreSettings Source #

Reasonable defaults for snapshot restores

  • snapRestoreWaitForCompletion False
  • snapRestoreIndices Nothing
  • snapRestoreIgnoreUnavailable False
  • snapRestoreIncludeGlobalState True
  • snapRestoreRenamePattern Nothing
  • snapRestoreRenameReplacement Nothing
  • snapRestorePartial False
  • snapRestoreIncludeAliases True
  • snapRestoreIndexSettingsOverrides Nothing
  • snapRestoreIgnoreIndexSettings Nothing