Search code examples
ruby-on-railselasticsearchherokuruby-on-rails-6bonsai-elasticsearch

How to Add Previously Stored Data in Elasticsearch index


hope you are fine!

I have implement elasticsearch Locally & also in production on Heroku but I face a problem on Heroku that when I create an index by

curl -XPUT https://your:[email protected]/blogs-blogs

I can search from the records which are newly added after making the index but not able to search from the records which I save before this index.


Solution

  • If you want to import your models in elasticsearch you can easily done by the following line

    heroku run bundle exec rake environment elasticsearch:import:model CLASS='Post' FORCE=true
    

    But make sure your Bonsai and other Es gems should be compatible with elasticsearch.