Search code examples
ruby-on-railssearchkick

Searchkick reindex on heroku


I keep getting this error when i deploy to heroku :

 Searchkick::MissingIndexError in PostsController#search
Index missing - run Post.reindex

It's working in development, but how do I reindex in production? Please include exact steps if possible.

Here is my controller for the reference :

def search
    @posts = Post.search(params[:search])
end

Solution

  • Okay I got it, for the people struggling with this run :

    heroku run rake searchkick:reindex CLASS=PutYourClassHere
    

    then

    heroku run rake db:migrate