playframework-elasticsearch
playframework-elasticsearch copied to clipboard
Re-index all models
We want to be able to manually rebuild the indices in case we lose elasticsearch or it gets out of sync with our production database. I am preparing a solution for this and I will issue a pull request once this is implemented. Basically, it will be a method which scans all available models, selects all records from the database, and indexes all of them as if they just have been created.
Bigger problem is when object is indexed in elasticsearch, but not in the database. Shouldn't there be another loop through all objects in the index and for each a check if it's in the DB, and if not - remove it from the index?
I'd rather delete all indices and then recreate them, because you need one indexing operation per model anyway. But it could be worth doing your way if you are live and don't want any downtime during reindexing (which could take a while).