Search code examples
ruby-on-railselasticsearchnitrousio

Installing ElasticSearch on Nitrous.io?


I'm trying to use Elasticsearch on Nitrous.io.

I'm following this tutorial but when trying to reindex the model I get this error

action@learning-rails-1868:~/fayl$ rake searchkick:reindex CLASS=Fail                                                                                                     
rake aborted!                                                                                                                                                             
Connection refused - connect(2)                                                                                                                                           
/home/action/.rvm/gems/ruby-1.9.3-p374/gems/rest-client-1.6.7/lib/restclient/request.rb:172:in `transmit'                                                                 
/home/action/.rvm/gems/ruby-1.9.3-p374/gems/rest-client- 1.6.7/lib/restclient/request.rb:64:in `execute'                                                                   
/home/action/.rvm/gems/ruby-1.9.3-p374/gems/tire-0.6.0/lib/tire/http/client.rb:11:in `get'                                                                                
/home/action/.rvm/gems/ruby-1.9.3-p374/gems/searchkick-0.2.8/lib/searchkick/reindex.rb:43:in `clean_indices'                                                              
/home/action/.rvm/gems/ruby-1.9.3-p374/gems/searchkick-0.2.8/lib/searchkick/reindex.rb:10:in `reindex'                                                                    
/home/action/.rvm/gems/ruby-1.9.3-p374/gems/searchkick-0.2.8/lib/searchkick/tasks.rb:10:in `block (2 levels) in <top (required)>'                                         
/home/action/.rvm/gems/ruby-1.9.3-p374/bin/ruby_noexec_wrapper:14:in `eval'                                                                                               
/home/action/.rvm/gems/ruby-1.9.3-p374/bin/ruby_noexec_wrapper:14:in `<main>'                                                                                             
Tasks: TOP => searchkick:reindex     

I'm not sure I've installed Elasticsearch on Nitrous.io properly. Has anyone managed to do this successfully? Or can you point to a guide for how to implement this?


Solution

  • I haven't tried nitrous.io, but you'll need to tell Searchkick where to find Elasticsearch.

    Create an initializer config/initializers/elasticsearch.rb with:

    ENV["ELASTICSEARCH_URL"] = "http://username:password@hostname"

    You could also use a hosted version like Searchly.