Currently i am using mongoose Model.remove method to remove a document. But after removing document mongoosastic index still contains deleted document index.
User.remove({_id:userId}, function(err) {
if (err) {
res.json({success:false});
}
else {
res.json({success:true})
}
});
This is caused because mongoose calls the delete index hook only when you do a user.remove() instead of User.remove({_id: userId}), for that reason mongoosastic could not delete this document.
You can see that in mongoostatic docs about removing documents:
https://github.com/mongoosastic/mongoosastic#removing-a-document
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With