/** * @param \Phalcon\Mvc\ModelInterface $model * * @throws Exception */ public function delete(\Phalcon\Mvc\ModelInterface $model) { $eventsManager = $this->getEventsManager(); if ($eventsManager instanceof \Phalcon\Events\ManagerInterface) { $eventsManager->fire("search:beforeDelete", $this); } $response = $this->elasticsearch->delete(["index" => $this->index, "type" => $model->getSource(), "id" => $this->getPrimaryKeyValue($model)]); if ($eventsManager instanceof \Phalcon\Events\ManagerInterface) { $eventsManager->fire("search:afterDelete", $this); } return $response; }