Elasticquent icon indicating copy to clipboard operation
Elasticquent copied to clipboard

delete/update item from index?

Open huglester opened this issue 8 years ago • 4 comments

Hello,

docs do not mention(?) what needs to be done when deleting/updating the Entity.

Is there something we should do manually when Entity was updated, or removed?

Thank you

huglester avatar Jan 03 '17 09:01 huglester

You could bind to a model events such as updated, deleted etc...

Then iterate through the relations:

$post->comments->each(function ($comment) {
    $comment->removeFromIndex();
});

$post->editors->each(function ($editor) {
    $editor->removeFromIndex();
});

I would do this asynchronously through a queue.

andrewmclagan avatar Jan 30 '17 07:01 andrewmclagan

@huglester you might be interested in this:

https://github.com/elasticquent/Elasticquent/pull/136/commits/cc2e18c3a0c5af8f83fbcddd45ff7476eb704f0b

timgws avatar Jan 30 '17 07:01 timgws

Thank you. @timgws - but this commit was not merged - right?

huglester avatar Jan 30 '17 17:01 huglester

Correct. The pull request includes a change to the composer.json file, so I will need to cherry pick the commit and merge it manually.

timgws avatar Jan 30 '17 21:01 timgws