Constants

LANG_MVEL

LANG_MVEL

LANG_JS

LANG_JS

LANG_GROOVY

LANG_GROOVY

LANG_PYTHON

LANG_PYTHON

LANG_NATIVE

LANG_NATIVE

Properties

$_params

$_params : array

Params.

Type

array

$_rawParams

$_rawParams : array

Raw Params.

Type

array

$_script

$_script : string

Type

string

$_lang

$_lang : string

Type

string

$_scriptFile

$_scriptFile : string

Type

string

Methods

__construct()

__construct(string  $scriptFile, array|null  $params = null, null  $id = null) 

Parameters

string $scriptFile
array|null $params
null $id

setLang()

setLang(string  $lang) : $this

Parameters

string $lang

Returns

$this

getLang()

getLang() : string

Returns

string

setScript()

setScript(string  $script) : $this

Parameters

string $script

Returns

$this

getScript()

getScript() : string

Returns

string

create()

create(string|array|\Elastica\ScriptFile  $data) : self

Parameters

string|array|\Elastica\ScriptFile $data

Throws

\Elastica\Exception\InvalidException

Returns

self

toArray()

toArray() : array

{@inheritdoc}

Returns

array

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

setTtl()

setTtl(string  $ttl) : $this

Sets lifetime of document.

Parameters

string $ttl

Returns

$this

getTtl()

getTtl() : string

Returns

string

hasTtl()

hasTtl() : boolean

Returns

boolean

setType()

setType(string  $type) : $this

Sets the document type name.

Parameters

string $type

Type name

Returns

$this

getType()

getType() : string

Return document type name.

Throws

\Elastica\Exception\InvalidException

Returns

string —

Document type name

setIndex()

setIndex(string  $index) : $this

Sets the document index name.

Parameters

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(integer  $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

integer $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

setPercolate()

setPercolate(string  $value = '*') : $this

Set percolate query param.

Parameters

string $value

percolator filter

Returns

$this

getPercolate()

getPercolate() : string

Get percolate parameter.

Returns

string

hasPercolate()

hasPercolate() : 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

setTimestamp()

setTimestamp(string  $timestamp) : $this

Parameters

string $timestamp

Returns

$this

getTimestamp()

getTimestamp() : integer

Returns

integer

hasTimestamp()

hasTimestamp() : 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() : string

Returns

string

setConsistency()

setConsistency(string  $timeout) : $this

Parameters

string $timeout

Returns

$this

getConsistency()

getConsistency() : string

Returns

string

hasConsistency()

hasConsistency() : string

Returns

string

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

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

setScriptFile()

setScriptFile(string  $scriptFile) : $this

Parameters

string $scriptFile

Returns

$this

getScriptFile()

getScriptFile() : string

Returns

string

_createFromArray()

_createFromArray(array  $data) : self

Parameters

array $data

Throws

\Elastica\Exception\InvalidException

Returns

self

_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