public function updateDocument($data, array $options = [])
{
if (!$data instanceof Document && !$data instanceof AbstractScript) {
throw new \InvalidArgumentException('Data should be a Document or Script');
}
if (!$data->hasId()) {
throw new InvalidException('Document or Script id is not set');
}
$id = urlencode($data->getId());
return $this->getIndex()->getClient()->updateDocument($id, $data, $this->getIndex()->getName(), $this->getName(), $options);
}