2013-10-10 55 views
0

我想索引接近90万个文档,但需要很长时间。我已经定义了其中包含的行索引的映射:弹性搜索:轮胎:数据导入太慢

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

因此,我相信有相当多的数据库查询,我索引模型。我使用的是默认配置:节点数量= 1,分片数量= 5,副本数量= 1。 每批1000份文件大约需要15分钟。

我该如何加快速度?

下面是我使用

rake environment tire:import CLASS='Expert' FORCE=true 
+0

如果内容很大,则导入需要时间。是否有可能减少在elasticsearch中索引的数据。在这种情况下,你可以获得一些时间,否则你不能。但是,花1000分钟15分钟的时间太多了。你在你的本地机器上运行这个吗? –

+0

轮胎导入只使用选择查询。 –

回答

0

作为替代你可以尝试用时间段平行进口耙命令。 不要使用武力选项在这种情况下

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])' 

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