Constants

LANG_MOUSTACHE

LANG_MOUSTACHE

LANG_EXPRESSION

LANG_EXPRESSION

LANG_PAINLESS

LANG_PAINLESS

Properties

$_params

$_params : array

Params.

Type

array

$_rawParams

$_rawParams : array

Raw Params.

Type

array

$_lang

$_lang : string

Type

string

Methods

setId()

setId(string  $id) : $this

Sets the id of the document.

Parameters

string $id

Returns

$this

getId()

getId() : string|integer

Returns document id.

Returns

string|integer —

Document id

hasId()

hasId() : boolean

Returns

boolean

setType()

setType(\Elastica\Type|string  $type) : $this

Sets the document type name.

Parameters

\Elastica\Type|string $type

Type name

Returns

$this

getType()

getType() : string

Return document type name.

Throws

\Elastica\Exception\InvalidException

Returns

string —

Document type name

setIndex()

setIndex(\Elastica\Index|string  $index) : $this

Sets the document index name.

Parameters

\Elastica\Index|string $index

Index name

Returns

$this

getIndex()

getIndex() : string

Get the document index name.

Throws

\Elastica\Exception\InvalidException

Returns

string —

Index name

setVersion()

setVersion(integer  $version) : $this

Sets the version of a document for use with optimistic concurrency control.

Parameters

integer $version

Document version

Returns

$this

getVersion()

getVersion() : string|integer

Returns document version.

Returns

string|integer —

Document version

hasVersion()

hasVersion() : boolean

Returns

boolean

setVersionType()

setVersionType(string  $versionType) : $this

Sets the version_type of a document Default in ES is internal, but you can set to external to use custom versioning.

Parameters

string $versionType

Document version type

Returns

$this

getVersionType()

getVersionType() : string|integer

Returns document version type.

Returns

string|integer —

Document version type

hasVersionType()

hasVersionType() : boolean

Returns

boolean

setParent()

setParent(string|integer  $parent) : $this

Sets parent document id.

Parameters

string|integer $parent

Parent document id

Returns

$this

getParent()

getParent() : string|integer

Returns the parent document id.

Returns

string|integer —

Parent document id

hasParent()

hasParent() : boolean

Returns

boolean

setOpType()

setOpType(string  $opType) : $this

Set operation type.

Parameters

string $opType

Only accept create

Returns

$this

getOpType()

getOpType() : string

Get operation type.

Returns

string

hasOpType()

hasOpType() : boolean

Returns

boolean

setRouting()

setRouting(string  $value) : $this

Set routing query param.

Parameters

string $value

routing

Returns

$this

getRouting()

getRouting() : string

Get routing parameter.

Returns

string

hasRouting()

hasRouting() : boolean

Returns

boolean

setFields()

setFields(array|string  $fields) : $this

Parameters

array|string $fields

Returns

$this

setFieldsSource()

setFieldsSource() : $this

Returns

$this

getFields()

getFields() : string

Returns

string

hasFields()

hasFields() : boolean

Returns

boolean

setRetryOnConflict()

setRetryOnConflict(integer  $num) : $this

Parameters

integer $num

Returns

$this

getRetryOnConflict()

getRetryOnConflict() : integer

Returns

integer

hasRetryOnConflict()

hasRetryOnConflict() : boolean

Returns

boolean

setRefresh()

setRefresh(boolean  $refresh = true) : $this

Parameters

boolean $refresh

Returns

$this

getRefresh()

getRefresh() : boolean

Returns

boolean

hasRefresh()

hasRefresh() : boolean

Returns

boolean

setTimeout()

setTimeout(string  $timeout) : $this

Parameters

string $timeout

Returns

$this

getTimeout()

getTimeout() : boolean

Returns

boolean

hasTimeout()

hasTimeout() : boolean

Returns

boolean

setConsistency()

setConsistency(string  $timeout) : $this

Parameters

string $timeout

Returns

$this

getConsistency()

getConsistency() : string

Returns

string

hasConsistency()

hasConsistency() : boolean

Returns

boolean

setReplication()

setReplication(string  $timeout) : $this

Parameters

string $timeout

Returns

$this

getReplication()

getReplication() : string

Returns

string

hasReplication()

hasReplication() : boolean

Returns

boolean

setUpsert()

setUpsert(\Elastica\Document|array  $data) : $this

Parameters

\Elastica\Document|array $data

Returns

$this

hasUpsert()

hasUpsert() : boolean

Returns

boolean

getOptions()

getOptions(array  $fields = array(), boolean  $withUnderscore = false) : array

Parameters

array $fields

if empty array all options will be returned, field names can be either with underscored either without, i.e. _percolate, routing

boolean $withUnderscore

should option keys contain underscore prefix

Returns

array

toArray()

toArray() 

{@inheritdoc}

setParam()

setParam(string  $key, mixed  $value) : $this

Sets (overwrites) the value at the given key.

Parameters

string $key

Key to set

mixed $value

Key Value

Returns

$this

setParams()

setParams(array  $params) : $this

Sets (overwrites) all params of this object.

Parameters

array $params

Parameter list

Returns

$this

addParam()

addParam(string  $key, mixed  $value) : $this

Adds a param to the list.

This function can be used to add an array of params

Parameters

string $key

Param key

mixed $value

Value to set

Returns

$this

getParam()

getParam(string  $key) : mixed

Returns a specific param.

Parameters

string $key

Key to return

Throws

\Elastica\Exception\InvalidException

If requested key is not set

Returns

mixed —

Key value

hasParam()

hasParam(string  $key) : boolean

Test if a param is set.

Parameters

string $key

Key to test

Returns

boolean —

True if the param is set, false otherwise

getParams()

getParams() : array

Returns the params array.

Returns

array —

Params

count()

count() : integer

{@inheritdoc}

Returns

integer

__construct()

__construct(array|null  $params = null, string|null  $lang = null, string|null  $documentId = null) 

Parameters

array|null $params
string|null $lang

Script language, see constants

string|null $documentId

Document ID the script action should be performed on (only relevant in update context)

setLang()

setLang(string  $lang) : $this

Parameters

string $lang

Returns

$this

getLang()

getLang() : string|null

Returns

string|null

_convertArrayable()

_convertArrayable(array  $array) : array

Cast objects to arrays.

Parameters

array $array

Returns

array

_getBaseName()

_getBaseName() : string

Param's name Picks the last part of the class name and makes it snake_case You can override this method if you want to change the name.

Returns

string —

name

_setRawParam()

_setRawParam(string  $key, mixed  $value) : $this

Sets params not inside params array.

Parameters

string $key
mixed $value

Returns

$this

getScriptTypeArray()

getScriptTypeArray() : array

Returns an array with the script type as key and the script content as value.

Returns

array

_createFromArray()

_createFromArray(array  $data) 

Parameters

array $data