Constants

OP_TYPE_CREATE

OP_TYPE_CREATE

OP_TYPE_INDEX

OP_TYPE_INDEX

OP_TYPE_DELETE

OP_TYPE_DELETE

OP_TYPE_UPDATE

OP_TYPE_UPDATE

Properties

$opTypes

$opTypes : array

Type

array

$_data

$_data : \Elastica\Document|\Elastica\Script\AbstractScript

Type

\Elastica\Document|\Elastica\Script\AbstractScript

$_opType

$_opType : string

Type

string

$_metadata

$_metadata : array

Type

array

$_source

$_source : array

Type

array

Methods

__construct()

__construct(string  $opType = self::OP_TYPE_INDEX, array  $metadata = array(), array  $source = array()) 

Parameters

string $opType
array $metadata
array $source

setDocument()

setDocument(\Elastica\Document  $document) : $this

Parameters

\Elastica\Document $document

Returns

$this

setScript()

setScript(\Elastica\Script\AbstractScript  $script) : $this

Parameters

\Elastica\Script\AbstractScript $script

Returns

$this

setData()

setData(\Elastica\Script\AbstractScript|\Elastica\Document  $data) : $this

Parameters

\Elastica\Script\AbstractScript|\Elastica\Document $data

Throws

\InvalidArgumentException

Returns

$this

getDocument()

getDocument() : \Elastica\Document|null

Note: This is for backwards compatibility.

Returns

\Elastica\Document|null

getScript()

getScript() : \Elastica\Script\AbstractScript|null

Note: This is for backwards compatibility.

Returns

\Elastica\Script\AbstractScript|null

getData()

getData() : \Elastica\Document|\Elastica\Script\AbstractScript

Returns

\Elastica\Document|\Elastica\Script\AbstractScript

create()

create(\Elastica\Document|\Elastica\Script\AbstractScript  $data, string  $opType = null) : static

Creates a bulk action for a document or a script.

The action can be index, update, create or delete based on the $opType param (by default index).

Parameters

\Elastica\Document|\Elastica\Script\AbstractScript $data
string $opType

Returns

static

setOpType()

setOpType(string  $type) : $this

Parameters

string $type

Returns

$this

getOpType()

getOpType() : string

Returns

string

setMetadata()

setMetadata(array  $metadata) : $this

Parameters

array $metadata

Returns

$this

getMetadata()

getMetadata() : array

Returns

array

getActionMetadata()

getActionMetadata() : array

Returns

array

setSource()

setSource(array|string  $source) : $this

Parameters

array|string $source

Returns

$this

getSource()

getSource() : array|string

Returns

array|string

hasSource()

hasSource() : boolean

Returns

boolean

setIndex()

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

Parameters

string|\Elastica\Index $index

Returns

$this

setId()

setId(string  $id) : $this

Parameters

string $id

Returns

$this

setRouting()

setRouting(string|integer  $routing) : $this

Parameters

string|integer $routing

Returns

$this

toArray()

toArray() : array

Returns

array

toString()

toString() : string

Returns

string

isValidOpType()

isValidOpType(string|null  $opType = null) : boolean

Parameters

string|null $opType

Returns

boolean

_getMetadata()

_getMetadata(\Elastica\AbstractUpdateAction  $action) : array

Parameters

\Elastica\AbstractUpdateAction $action

Returns

array