skukx/solidus_recommendations

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.

skukx commented

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

Hi @skukx , thanks for your answer, this solved my heroku issue!!!!