yii\elasticsearch\Connection::createCommand PHP Method

createCommand() public method

Creates a command for execution.
public createCommand ( array $config = [] ) : Command
$config array the configuration for the Command class
return Command the DB command
    public function createCommand($config = [])
    {
        $this->open();
        $config['db'] = $this;
        $command = new Command($config);
        return $command;
    }

Usage Example

コード例 #1
0
 /**
  * Insert or Update a document into the index.
  */
 public function InsertUpdate()
 {
     // Remove all new lines etc. from the json to make it valid
     $this->query = str_replace(array('\\n', '\\r'), '', $this->query);
     $connection = new Connection();
     $command = $connection->createCommand();
     $command->insert('api-builder', 'api', $this->query, $this->api->id);
 }
All Usage Examples Of yii\elasticsearch\Connection::createCommand