2017-07-18 39 views
0

我正在使用Elasticsearch版本1.7.5。在升級到2.x版本(甚至是5.x版本)之前,我需要對五個大型索引進行重新索引,以符合2.x標準。Elasticsearch - 在不使用Logstash或滾動API的情況下重建索引數據的最佳方式是什麼?

不幸的是,Logstash(和滾動API)無法重新索引我的數據,因爲this problem


我的問題:

  • 什麼是重新索引我的數據,而無需使用Logstash或滾動API的最佳方式?
    • 如果可能,我寧願使用Nest。
+0

此答案可能有所幫助:https://stackoverflow.com/questions/34921637/how-to-copy- one-index-documents-to-other-index-in-elasticsearch/34922623#34922623 – Val

+0

@Val:謝謝。不幸的是,所有這些解決方案都使用滾動API。 –

+0

[此文檔](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/reindex-upgrade.html)有幫助嗎? – Adonis

回答

1

如果你的目標Elasticsearch 5.0以上,則可以使用reindex API從遠程Elasticsearch集羣(1.7.5的集羣)的數據重新編製成Elasticsearch 5.0+。

NEST 5.x的暴露重新索引API作爲ReindexOnServer()方法

client.ReindexOnServer(r => r 
    .Source(s => s 
     .Remote(sr => sr 
      // URI to 1.7.5 cluster 
      .Host(new Uri("http://localhost:9201")) 
     ) 
     .Index("entries") 
    ) 
    .Destination(d => d 
     .Index("entries") 
    ) 
    .WaitForCompletion(true) 
); 

WaitForCompletion確定呼叫是否應該等待重新索引來完成。如果這是錯誤的,響應中的Task屬性可用於檢查操作的狀態,使用tasks API

相關問題