2017-07-18 75 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

相关问题