Ask A Question

Notifications

You’re not receiving notifications from this thread.

how to setup elasticsearch on Heroku?

Jeramae Bohol asked in Servers

I implemented the elasticsearch/searchkick on my app and it works on develoment. But it's not working on production. I did heroku logs and these are the errors:

"Completed 500 Internal Server Error in 16ms (Searchkick: 8.0ms | ActiveRecord: 0.0ms)"

"Faraday::ConnectionFailed (Connection refused - connect(2) for "localhost" port 9200):"

Reply

Here's an article on Bonsai which let's you do Elasticsearch on Heroku.

https://devcenter.heroku.com/articles/bonsai & https://docs.bonsai.io/docs/ruby-on-rails

I don't have any experience with running elasticsearch on heroku but give that article a shot and the docs on bonsai's site and see if that gets you to a better spot to troubleshoot with.

Reply

Actually the solution is in the searchkick readme https://github.com/ankane/searchkick#deployment

Reply

What I've noticed is that bonsai elastic search (sandbox plan on heroku) once added to your pipeline and hooked up to your application does not use port :9200.

If you get to your environment settings , and take a look at the bonzai url, you'll see there is no port on it.

https://medium.com/@thecolorfulcrayon/configuring-elasticsearch-on-rails-8bcbe973e9e7

according to this, by creating a yaml file with the production url, it should work? (testing it now)

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 87,400+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.