/**
* 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);
}