0

我想索引近 900,000 个文档,但这需要很长时间。我定义了一个映射,其中包含以下行的索引:

indexes :residencies_with_year,     type: 'string',     :as => 'residencies_obj.map{|r| ExpertProfile.residency_with_year_to_s(r)}'

因此,我相信在索引模型时会有很多数据库查询。我使用默认配置:节点数=1,分片数=5,副本数=1。每批 1000 个文档大约需要 15 分钟。

我怎样才能加快速度?

这是我正在使用的 rake 命令

rake environment tire:import CLASS='Expert' FORCE=true
4

1 回答 1

0

作为替代方案,您可以尝试使用时间范围进行并行导入。在这种情况下不要使用 force 选项

rake environment tire:import CLASS='Expert.scoped(:conditions => [created_at<? and created_at>?', Time.now.utc, Time1])'
rake environment tire:import CLASS='Expert.scoped(:conditions => [created_at<? and created_at>?', Time1, Time2])'
rake environment tire:import CLASS='Expert.scoped(:conditions => [created_at<? and created_at>?', Time2, Time3])'

这可能会加快导入过程的总时间

于 2013-10-10T08:15:11.520 回答