我正在尝试在Nitrous.io上使用Elasticsearch。
我正在关注this tutorial,但在尝试重新索引模型时,我收到此错误
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
我不确定我是否正确地在Nitrous.io上安装了Elasticsearch。有没有人成功地做到了这一点?或者你能指出一个如何实现这个的指南吗?
答案 0 :(得分:5)
我没有尝试过nitrous.io,但你需要告诉Searchkick在哪里可以找到Elasticsearch。
使用以下内容创建初始值设定项config/initializers/elasticsearch.rb
ENV["ELASTICSEARCH_URL"] = "http://username:password@hostname"
您还可以使用Searchly等托管版本。