我试图通过searchkick重新索引heroku应用程序。它目前在localhost上重新索引。
我在localhost上运行的命令就是这个
rake searchkick:reindex CLASS=Newevent
我一直在关注github教程并完成了这个
heroku run rake searchkick:reindex CLASS=Newevent
目前返回此内容,
heroku run rake searchkick:reindex CLASS=Newevent
Running rake searchkick:reindex CLASS=Newevent on //APPNAMEREMOVED//... up, run.7334
rake aborted!
URI::InvalidURIError: bad URI(is not URI?): http://heroku congif:0
/app/vendor/bundle/ruby/2.2.0/gems/faraday-0.9.2/lib/faraday/utils.rb:258:in `call'
/app/vendor/bundle/ruby/2.2.0/gems/faraday-0.9.2/lib/faraday/utils.rb:258:in `URI'
/app/vendor/bundle/ruby/2.2.0/gems/faraday-0.9.2/lib/faraday/connection.rb:309:in `url_prefix='
/app/vendor/bundle/ruby/2.2.0/gems/faraday-0.9.2/lib/faraday/connection.rb:77:in `initialize'
/app/vendor/bundle/ruby/2.2.0/gems/elasticsearch-transport-1.0.14/lib/elasticsearch/transport/transport/http/faraday.rb:47:in `new'
/app/vendor/bundle/ruby/2.2.0/gems/elasticsearch-transport-1.0.14/lib/elasticsearch/transport/transport/http/faraday.rb:47:in `block in __build_connections'
/app/vendor/bundle/ruby/2.2.0/gems/elasticsearch-transport-1.0.14/lib/elasticsearch/transport/transport/http/faraday.rb:36:in `map'
/app/vendor/bundle/ruby/2.2.0/gems/elasticsearch-transport-1.0.14/lib/elasticsearch/transport/transport/http/faraday.rb:36:in `__build_connections'
/app/vendor/bundle/ruby/2.2.0/gems/elasticsearch-transport-1.0.14/lib/elasticsearch/transport/transport/base.rb:34:in `initialize'
/app/vendor/bundle/ruby/2.2.0/gems/elasticsearch-transport-1.0.14/lib/elasticsearch/transport/client.rb:105:in `new'
/app/vendor/bundle/ruby/2.2.0/gems/elasticsearch-transport-1.0.14/lib/elasticsearch/transport/client.rb:105:in `initialize'
/app/vendor/bundle/ruby/2.2.0/gems/elasticsearch-transport-1.0.14/lib/elasticsearch/transport.rb:26:in `new'
/app/vendor/bundle/ruby/2.2.0/gems/elasticsearch-transport-1.0.14/lib/elasticsearch/transport.rb:26:in `new'
/app/vendor/bundle/ruby/2.2.0/gems/searchkick-1.0.2/lib/searchkick.rb:43:in `client'
/app/vendor/bundle/ruby/2.2.0/gems/searchkick-1.0.2/lib/searchkick/index.rb:510:in `client'
/app/vendor/bundle/ruby/2.2.0/gems/searchkick-1.0.2/lib/searchkick/index.rb:148:in `clean_indices'
/app/vendor/bundle/ruby/2.2.0/gems/searchkick-1.0.2/lib/searchkick/index.rb:161:in `reindex_scope'
/app/vendor/bundle/ruby/2.2.0/gems/searchkick-1.0.2/lib/searchkick/model.rb:51:in `searchkick_reindex'
/app/vendor/bundle/ruby/2.2.0/gems/searchkick-1.0.2/lib/searchkick/tasks.rb:9:in `block (2 levels) in <top (required)>'
Tasks: TOP => searchkick:reindex
(See full trace by running task with --trace)
我很乐意在需要的时候分享更多代码,只是不确定你需要什么,所以我没有包含负载
由于
答案 0 :(得分:3)
阅读searchkick的文档:https://github.com/ankane/searchkick
有一个用于配置HEROKU应用程序的部分。宝石引用ENV["ELASTICSEARCH_URL"]
作为搜索URL。我不建议将URL放在配置文件中。 Heroku方式是使用ENV变量。
答案 1 :(得分:1)
您应在config/secrets.yml
production:
secret_key_base:xxxxxxxxxxxxxx
elastic_search_url: http://localhost:9200