我的数据库有超过300万个要编制索引的文档。这是我的设置:
Heroku上的Rails 4.2.0beta2。将Searchkick与Found Heroku插件一起使用。
这些是我编入索引的模型:
class Item
searchkick text_start: [:n, :ot, :est]
def search_data
# as_json only: [:n, :ot, :est, :dst, :d, :a]
{
n: n,
ot: detail.ot,
est: detail.est,
dst: dst,
d: detail.d,
a: detail.a
}
end
端
class User
searchkick text_start: [:full_name]
def full_name
"#{first_name} #{last_name}"
end
def search_data
{
full_name: full_name
}
end
end
..通过rake searchkick:reindex:all
。
现在,我注意到我们的Elasticsearch集群仅索引了一半的文档(~1.5M)。我问我们的集群提供商是否对文档数量有任何限制并确认没有。我不知道为什么它停在1.5M(而不是索引全部300万)。然而,现在我试图再次索引所有内容并注意错误或类似的东西,这是它出现的第一件事(在索引任何内容之前):
NameError: undefined local variable or method `index' for #<Searchkick::Index:0x007fbb5308bf18>
from /Users/borjagvo/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/searchkick-0.8.6/lib/searchkick/index.rb:192:in `block in import_scope'
from /Users/borjagvo/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/mongoid-4.0.1/lib/mongoid/contextual/mongo.rb:648:in `yield_document'
from /Users/borjagvo/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/mongoid-4.0.1/lib/mongoid/contextual/mongo.rb:123:in `block in each'
from /Users/borjagvo/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/moped-2.0.3/lib/moped/cursor.rb:32:in `block in each'
from /Users/borjagvo/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/moped-2.0.3/lib/moped/cursor.rb:32:in `each'
from /Users/borjagvo/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/moped-2.0.3/lib/moped/cursor.rb:32:in `each'
from /Users/borjagvo/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/moped-2.0.3/lib/moped/query.rb:77:in `each'
from /Users/borjagvo/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/mongoid-4.0.1/lib/mongoid/contextual/mongo.rb:122:in `each'
from /Users/borjagvo/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/mongoid-4.0.1/lib/mongoid/contextual.rb:20:in `each'
from /Users/borjagvo/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/searchkick-0.8.6/lib/searchkick/index.rb:189:in `import_scope'
from /Users/borjagvo/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/searchkick-0.8.6/lib/searchkick/index.rb:158:in `reindex_scope'
from /Users/borjagvo/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/searchkick-0.8.6/lib/searchkick/model.rb:47:in `reindex'
from (irb):1
from /Users/borjagvo/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/commands/console.rb:110:in `start'
from /Users/borjagvo/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/commands/console.rb:9:in `start'
from /Users/borjagvo/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:68:in `console'
... 7 levels...
from /Users/borjagvo/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
from /Users/borjagvo/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `block in load'
from /Users/borjagvo/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/borjagvo/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
from /Users/borjagvo/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.3.1/lib/spring/commands/rails.rb:6:in `call'
from /Users/borjagvo/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.3.1/lib/spring/command_wrapper.rb:38:in `call'
from /Users/borjagvo/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.3.1/lib/spring/application.rb:183:in `block in serve'
from /Users/borjagvo/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.3.1/lib/spring/application.rb:156:in `fork'
from /Users/borjagvo/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.3.1/lib/spring/application.rb:156:in `serve'
from /Users/borjagvo/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.3.1/lib/spring/application.rb:131:in `block in run'
from /Users/borjagvo/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.3.1/lib/spring/application.rb:125:in `loop'
from /Users/borjagvo/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.3.1/lib/spring/application.rb:125:in `run'
from /Users/borjagvo/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/spring-1.3.1/lib/spring/application/boot.rb:18:in `<top (required)>'
from /Users/borjagvo/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/borjagvo/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
一旦出现此错误,检查群集状态,我看到创建了一个新索引,而不是&#34;覆盖&#34;旧的:http://cl.ly/image/0I0v1a2T1N2W
我做错了什么?关于如何解决这个问题的任何想法?
提前致谢。