Skip to main content

ElasticSearch connection refused

Gems / Libraries • Asked by Mason Donley

I am going through the ElasticSearch with searchkick video and I have installed ElasticSearch on my ubuntu box as well as installed searckick and added searckick to my model. Everytime I try to reindex my model I get "Faraday::ConnectionFailed: Failed to open TCP connection to localhost:9200 (Connection refused - connect(2) for "localhost" port 9200)". All the settings are default on my ElasticSearch installation, I have also started and restarted ElasticSearch.


Do proper indexing of Models which you are including in search.
# Student.elasticsearch.create_index!
**** # Student.import
like this


Mason, I know this was over a year ago you posted about it, but just curious if you ever fixed this. Or more importantly if you remember how you fixed it.

Running into the same issue on my end.


In my instance the issue was with localhost not being represented in my hosts file.

I adeed the following to it and was able to get past this.

127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost
fe80::1%lo0     localhost

Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 24,647+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.