yii\elasticsearch\BulkCommand::addDeleteAction PHP Method

addDeleteAction() public method

Adds a delete action to the command.
public addDeleteAction ( string $id, string $index = null, string $type = null )
$id string Document ID
$index string Index that the document belogs to. Can be set to null if the command has a default index ([[BulkCommand::$index]]) assigned.
$type string Type that the document belogs to. Can be set to null if the command has a default type ([[BulkCommand::$type]]) assigned.
    public function addDeleteAction($id, $index = null, $type = null)
    {
        $actionData = ['_id' => $id];
        if (!empty($index)) {
            $actionData['_index'] = $index;
        }
        if (!empty($type)) {
            $actionData['_type'] = $type;
        }
        $this->addAction(['delete' => $actionData]);
    }