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

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

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

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

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2023 GoRails, LLC. All rights reserved.