2016-07-22 209 views

回答

1

您有幾個選項。您可以以從舊1.x的ES指數複製到新2.X ES使用Logstash

input { 
    elasticsearch { 
    hosts => ["old-es:9200"]      <--- source ES host 
    index => "source_index"      <--- source index to copy 
    docinfo => true 
    } 
} 
filter { 
mutate { 
    remove_field => [ "@version", "@timestamp" ] <--- remove added junk 
} 
} 
output { 
elasticsearch { 
    hosts => ["new-es:9200]"      <--- target ES host 
    index => "%{[@metadata][_index]}" 
    document_type => "%{[@metadata][_type]}" 
    document_id => "%{[@metadata][_id]}" 
} 
} 

您還可以使用elasticdump並使用以下命令從old-es:9200複製source_indexnew-es:9200主機:

elasticdump \ 
    --input=http://old-es:9200/source_index \ 
    --output=http://new-es:9200/source_index \ 
    --type=analyzer 
elasticdump \ 
    --input=http://old-es:9200/source_index \ 
    --output=http://new-es:9200/source_index \ 
    --type=mapping 
elasticdump \ 
    --input=http://old-es:9200/source_index \ 
    --output=http://new-es:9200/source_index \ 
    --type=data 
+0

非常感謝@val ..你是驚人的.. :)我沒有用elasticdump作爲我的兩個服務器是不同的網絡中,並沒有路由,所以我不能使用logstash。隨着elasticdumnp我把轉儲文件,然後將文件轉移到新的實例,並把轉儲在新的服務器。它工作完美..再次感謝 – user1819071

+0

真棒,很高興它幫助! – Val