Sleimanx2\Plastic\Connection::updateStatement PHP Method

updateStatement() public method

Execute a update statement on index;.
public updateStatement ( array $params ) : array
$params array
return array
    public function updateStatement(array $params)
    {
        return $this->elastic->update($this->setStatementIndex($params));
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Update a model document.
  *
  * @throws \Exception
  *
  * @return mixed
  */
 public function update()
 {
     $this->exitIfModelNotSet();
     if (!$this->model->exists) {
         throw new \Exception('Model not persisted yet');
     }
     $document = $this->model->getDocumentData();
     $params = ['id' => $this->model->getKey(), 'type' => $this->model->getDocumentType(), 'index' => $this->model->getDocumentIndex(), 'body' => ['doc' => $document]];
     return $this->connection->updateStatement($params);
 }