bloodhound-0.2.0.0: ElasticSearch client library for Haskell

Safe HaskellNone

Database.Bloodhound.Types

Description

Data types for describing actions and data structures performed to interact with Elasticsearch. The two main buckets your queries against Elasticsearch will fall into are Querys and Filters. Filters are more like traditional database constraints and often have preferable performance properties. Querys support human-written textual queries, such as fuzzy queries.

Synopsis

Documentation

maybeJson :: ToJSON a => Text -> Maybe a -> [(Text, Value)]Source

maybeJsonF :: (ToJSON (f Value), ToJSON a, Functor f) => Text -> Maybe (f a) -> [(Text, Value)]Source

mkSort :: FieldName -> SortOrder -> DefaultSortSource

mkSort defaults everything but the FieldName and the SortOrder so that you can concisely describe the usual kind of SortSpecs you want.

showText :: Show a => a -> TextSource

unpackId :: DocId -> StringSource

unpackId is a silly convenience function that gets used once.

mkMatchQuery :: FieldName -> QueryString -> MatchQuerySource

mkMatchQuery is a convenience function that defaults the less common parameters, enabling you to provide only the FieldName and QueryString to make a MatchQuery

mkMultiMatchQuery :: [FieldName] -> QueryString -> MultiMatchQuerySource

mkMultiMatchQuery is a convenience function that defaults the less common parameters, enabling you to provide only the list of FieldNames and QueryString to make a MultiMatchQuery.

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 

Fields

ok :: Bool
 
status :: Int
 
name :: Text
 
version :: Version
 
tagline :: Text
 

newtype Existence Source

Constructors

Existence Bool 

newtype NullValue Source

Constructors

NullValue Bool 

newtype Server Source

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

Constructors

Server String 

Instances

type Reply = Response ByteStringSource

Reply and Method are type synonyms from Method

data EsResult a Source

EsResult describes the standard wrapper JSON document that you see in successful Elasticsearch responses.

Constructors

EsResult 

Fields

_index :: Text
 
_type :: Text
 
_id :: Text
 
_version :: Int
 
found :: Maybe Bool
 
_source :: a
 

Instances

Eq a => Eq (EsResult a) 
Show a => Show (EsResult a) 
FromJSON a => FromJSON (EsResult a) 

data Search Source

Constructors

Search 

Fields

queryBody :: Maybe Query
 
filterBody :: Maybe Filter
 
sortBody :: Maybe Sort
 
trackSortScores :: TrackSortScores
 
from :: From
 
size :: Size
 

data FromJSON a => SearchResult a Source

Constructors

SearchResult 

Instances

data FromJSON a => SearchHits a Source

Constructors

SearchHits 

Fields

hitsTotal :: Int
 
maxScore :: Score
 
hits :: [Hit a]
 

Instances

(Eq a, FromJSON a) => Eq (SearchHits a) 
(Show a, FromJSON a) => Show (SearchHits a) 
FromJSON a => FromJSON (SearchHits a) 

data FromJSON a => Hit a Source

Constructors

Hit 

Instances

(Eq a, FromJSON a) => Eq (Hit a) 
(Show a, FromJSON a) => Show (Hit a) 
FromJSON a => FromJSON (Hit a) 

class Monoid a => Seminearring a whereSource

Methods

(<||>) :: a -> a -> aSource

(<&&>) :: a -> a -> aSource

Instances

data Term Source

Constructors

Term 

Fields

termField :: Text
 
termValue :: Text
 

Instances

data LatLon Source

Constructors

LatLon 

Fields

lat :: Double
 
lon :: Double
 

newtype LessThan Source

Constructors

LessThan Double 

Instances

newtype LessThanEq Source

Constructors

LessThanEq Double 

newtype Regexp Source

Constructors

Regexp Text 

Instances

newtype FieldName Source

FieldName is used all over the place wherever a specific field within a document needs to be specified, usually in Querys or Filters.

Constructors

FieldName Text 

newtype IndexName Source

IndexName is used to describe which index to querycreatedelete

Constructors

IndexName String 

newtype MappingName Source

MappingName is part of mappings which are how ES describes and schematizes the data in the indices.

Constructors

MappingName String 

newtype DocId Source

DocId is a generic wrapper value for expressing unique Document IDs. Can be set by the user or created by ES itself. Often used in client functions for poking at specific documents.

Constructors

DocId String 

newtype CacheName Source

CacheName is used in RegexpFilter for describing the CacheKey keyed caching behavior.

Constructors

CacheName Text 

newtype CacheKey Source

CacheKey is used in RegexpFilter to key regex caching.

Constructors

CacheKey Text 

Instances

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.

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-bulk.html#docs-bulk

type Sort = [SortSpec]Source

Sort is a synonym for a list of SortSpecs. Sort behavior is order dependent with later sorts acting as tie-breakers for earlier sorts.

data SortMode Source

SortMode prescribes how to handle sorting array/multi-valued fields.

http:www.elasticsearch.orgguideenelasticsearchreferencecurrentsearch-request-sort.html#_sort_mode_option

Constructors

SortMin 
SortMax 
SortSum 
SortAvg 

data Missing Source

Missing prescribes how to handle missing fields. A missing field can be sorted last, first, or using a custom value as a substitute.

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-sort.html#_missing_values

newtype Boost Source

Constructors

Boost Double 

newtype QueryString Source

QueryString is used to wrap query text bodies, be they human written or not.

Constructors

QueryString Text 

data BooleanOperator Source

BooleanOperator is the usual And/Or operators with an ES compatible JSON encoding baked in. Used all over the place.

Constructors

And 
Or 

newtype Lenient Source

Lenient, if set to true, will cause format based failures to be ignored. I don't know what the bloody default is, Elasticsearch documentation didn't say what it was. Let me know if you figure it out.

Constructors

Lenient Bool 

newtype MinimumMatch Source

MinimumMatch controls how many should clauses in the bool query should match. Can be an absolute value (2) or a percentage (30%) or a combination of both.

Constructors

MinimumMatch Int 

newtype PrefixLength Source

PrefixLength is the prefix length used in queries, defaults to 0.

Constructors

PrefixLength Int 

newtype PhraseSlop Source

PhraseSlop sets the default slop for phrases, 0 means exact phrase matches. Default is 0.

Constructors

PhraseSlop Int 

data FieldDefinition Source

Constructors

FieldDefinition 

Fields

fieldType :: FieldType
 

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 

Instances

newtype AllowLeadingWildcard Source

Allowing a wildcard at the beginning of a word (eg *ing) is particularly heavy, because all terms in the index need to be examined, just in case they match. Leading wildcards can be disabled by setting AllowLeadingWildcard to false.

newtype Locale Source

Locale is used for string conversions - defaults to ROOT.

Constructors

Locale Text 

newtype AnalyzeWildcard Source

By default, wildcard terms in a query are not analyzed. Setting AnalyzeWildcard to true enables best-effort analysis.

Constructors

AnalyzeWildcard Bool