playframework-elasticsearch icon indicating copy to clipboard operation
playframework-elasticsearch copied to clipboard

Re-index all models

Open isamaru opened this issue 12 years ago • 2 comments

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.

isamaru avatar Aug 29 '12 11:08 isamaru

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?

kretes avatar Aug 29 '12 12:08 kretes

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).

isamaru avatar Aug 29 '12 13:08 isamaru