Sleimanx2\Plastic\Connection::indexStatement PHP Method

indexStatement() public method

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

Usage Example

Ejemplo n.º 1
0
 /**
  * Save a model instance.
  *
  * @throws \Exception
  *
  * @return mixed
  */
 public function save()
 {
     $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' => $document];
     return $this->connection->indexStatement($params);
 }