ankane / searchkick

Intelligent search made easy
MIT License
6.55k stars 759 forks source link

Recommended deployment reindex strategy? #861

Closed afomera closed 7 years ago

afomera commented 7 years ago

Hi all,

I'm curious what the recommended deployment strategy is after you'd done a deploy and have a working implementation.

For example if we made changes to our model's searchkick or search_data methods we'd need to reindex. Is the solution to just reindex all of our models on each deploy with the rake task?

A little context, in this case we're using capistrano to do our deployments but want to move to use CI to do auto-deployments but want to ensure if we change the searchkick method or search_data things work properly.

Can anyone give some advice on how they'd handle this situation?

Thanks so much for this great gem!

feliperaul commented 7 years ago

We're writing migrations (rails g migration reindex_todays_date) empty with Model.reindex, so we make sure the reindex happens before the new version is released to users.

ankane commented 7 years ago

Hey @king601, you can reindex with each deploy, but it'll put extra load on the Elasticsearch server. I'd recommend reindexing manually when needed. In either scenario, you should make changes backwards compatible so you can push them without anything breaking before the reindex completes.

afomera commented 7 years ago

Thank you @ankane and @feliperaul appreciate it!

Gonna go ahead and close this.. Thanks for the great gem @ankane, we really love it!