Open marciomansur opened 9 years ago
/* * Remove From Search Index * @return array */ public function removeFromIndex() { return $this->getElasticSearchClient()->delete($this->getBasicEsParams()); }
/* * Delete From Index * @return array */ public function deleteFromIndex() { $all = $this->all();
$params = array();
foreach ($all as $item) {
$params['body'][] = array(
'delete' => array(
'_id' => $item->getKey(),
'_type' => $item->getTypeName(),
'_index' => $item->getIndexName()
)
);
}
return $this->getElasticSearchClient()->bulk($params);
}
How do I call it? I didn't find this on Elasticquent documentation. Do I need to instantiate the ElasticquentTrait?
check this solution for reference https://github.com/elasticquent/Elasticquent/issues/36#issuecomment-184631352
I'm using Elasticquent to work with mysql. When I update and insert data, the addAllToIndex and reindex methods works great. But when I want to delete something, the data that I deleted is still there.
How can I delete data in elasticquent?