Skipping index creation, cannot connect to Elasticsearch

1.1k views Asked by At

I'm having difficulty with connecting my Heroku app to an Elasticsearch instance. I'm using the tire gem and the bonsai add-on on Heroku.

When I deploy the application I get this error twice:

Skipping index creation, cannot connect to Elasticsearch

I also have this in my initialize bonsai.rb file:

if ENV['BONSAI_INDEX_URL']
  bonsai_uri = URI.parse(ENV['BONSAI_INDEX_URL'])
  Tire.configure do
    url "http://sampleindex.bonsai.io"
  end
  BONSAI_INDEX_NAME = bonsai_uri.path[1..-1]
else
  BONSAI_INDEX_NAME = "my_index"
end
1

There are 1 answers

0
zeantsoi On BEST ANSWER

Looking like you may be pointing to an invalid ElasticSearch URL. Try typing the following from the command line:

heroku config | grep BONSAI
#=> BONSAI_URL     => http://ql9lsrn8:[email protected]/

This should return the operating URL on Heroku's Bonsai service. Use this in your configuration:

Tire.configure do
  url "http://ql9lsrn8:[email protected]/"
end