Heroku deployment error
Closed this issue · 2 comments
Hello, I am using heroku but I have problems with this gem:
Elasticsearch::Transport::Transport::Errors::NotFound in Spree::UserSessionsController#create
[404] {"error":{"root_cause":[{"type":"index_not_found_exception",
I added addon bonsai for elasticsearch and installed gems:
gem 'elasticsearch-model'
gem 'elasticsearch-rails'
gem 'bonsai-elasticsearch-rails'
But I get the error anyway.
I have to do something else? Bonsai url working.
@sechix From what I can tell in the error, it looks like the index hasn't been created yet. You may need to create it by running
Spree.user_class.__elasticsearch__.create_index!
Spree::Order.__elasticsearch__.create_index!
The gem is built on top of elasticsearch-model In case you're wondering where that method comes from.
Let me know if that solves your problem. Once the index is created, be sure to import any data you may have
Spree.user_class.import
Spree::Order.import
Note that if you have millions of users/orders, that call can take a long time. If that is the case, I recommend using a background task to do so (I use sidekiq).