新手问题 线上部署 Ruby China 帖子页面报错:Elasticsearch::Transport::Transport::Errors::NotFound

pcdotfan · 2016年06月07日 · 最后由 pcdotfan 回复于 2016年06月09日 · 3081 次阅读

小弟初接触 Rails,昨天一整天都在折腾 Ruby China 的部署……环境 Nginx + Puma,已按照官方 Wiki Ubuntu 14.04 上使用 Nginx Passenger 部署 Ruby on Rails 步骤完成。但在帖子页面还是出现了报错:

Elasticsearch::Transport::Transport::Errors::NotFound in Topics#show

Showing /blablabla/wordpress-log/app/views/topics/_related_topics.html.erb where line #2 raised:

[404] {"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index","index":"topics","resource.type":"index_or_alias","resource.id":"topics"}],"type":"index_not_found_exception","reason":"no such index","index":"topics","resource.type":"index_or_alias","resource.id":"topics"},"status":404}
Extracted source (around line #97):

===
      size: size
    }
    self.class.__elasticsearch__.search(opts).records.to_a
  end

  def self.fields_for_list
===

Trace of template inclusion: app/views/topics/show.html.erb

请问问题出在哪里?恳求各位大大指教!

你的Elasticsearch没有部署或者配置好

#1 楼 @zhang_soledad 部署只是按照教程上的那样做,然后 sudo service elasticsearch start 而已=-=具体需要怎么部署呢?

打开 console,手工 import

> Topic.import
RAILS_ENV=env bundle exec rake environment elasticsearch:import:model CLASS='Topic' FORCE=y --trace
RAILS_ENV=env bundle exec rake environment elasticsearch:import:model CLASS='Page' FORCE=y --trace
RAILS_ENV=env bundle exec rake environment elasticsearch:import:model CLASS='User' FORCE=y --trace

@gyorou @lihuazhang 感谢各位,问题解决!

需要 登录 后方可回复, 如果你还没有账号请 注册新账号