Class yii\elasticsearch\BulkCommand

Inheritanceyii\elasticsearch\BulkCommand » yii\base\Component
Available since version2.0.5

The yii\elasticsearch\BulkCommand class implements the API for accessing the Elasticsearch bulk REST API.

Further details on bulk API is available in Elasticsearch guide.

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$actions array|string Actions to be executed in this bulk command, given as either an array of arrays or as one newline-delimited string. yii\elasticsearch\BulkCommand
$db yii\elasticsearch\Connection yii\elasticsearch\BulkCommand
$index string Default index to execute the queries on. yii\elasticsearch\BulkCommand
$options array Options to be appended to the query URL. yii\elasticsearch\BulkCommand
$type string Default type to execute the queries on. yii\elasticsearch\BulkCommand

Public Methods

Hide inherited methods

MethodDescriptionDefined By
addAction() Adds an action to the command. Will overwrite existing actions if they are specified as a string. yii\elasticsearch\BulkCommand
addDeleteAction() Adds a delete action to the command. yii\elasticsearch\BulkCommand
execute() Executes the bulk command. yii\elasticsearch\BulkCommand

Property Details

$actions public property

Actions to be executed in this bulk command, given as either an array of arrays or as one newline-delimited string. All actions except delete span two lines.

public array|string $actions null
$db public property
$index public property

Default index to execute the queries on. Defaults to null meaning that index needs to be specified in every action.

public string $index null
$options public property

Options to be appended to the query URL.

public array $options = []
$type public property

Default type to execute the queries on. Defaults to null meaning that type needs to be specified in every action.

public string $type null

Method Details

addAction() public method

Adds an action to the command. Will overwrite existing actions if they are specified as a string.

See also https://www.elastic.co/guide/en/elasticsearch/reference/7.x/docs-bulk.html.

public void addAction ( $line1, $line2 null )
$line1 array

First action expressed as an array (will be encoded to JSON automatically).

$line2 array|null

Second action expressed as an array (will be encoded to JSON automatically).

addDeleteAction() public method

Adds a delete action to the command.

public void addDeleteAction ( $id, $index null, $type null )
$id string

Document ID

$index string|null

Index that the document belongs to. Can be set to null if the command has a default index (yii\elasticsearch\BulkCommand::$index) assigned.

$type string|null

Type that the document belongs to. Can be set to null if the command has a default type (yii\elasticsearch\BulkCommand::$type) assigned.

execute() public method

Executes the bulk command.

public mixed execute ( )
throws \yii\base\InvalidCallException