Ask A Question


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):"


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

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.


Actually the solution is in the searchkick readme


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.

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

Join the discussion
Create an account Log in

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

Join 82,160+ 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.

    © 2024 GoRails, LLC. All rights reserved.