2013-10-10 54 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])' 

這可能會加速導入過程的總時間