mongoosastic index data not getting deleted after removing document mongoosastic index data not getting deleted after removing document mongoose mongoose

mongoosastic index data not getting deleted after removing document


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