2017-09-27 7 views
0

私はステージング環境からプロダクト環境への弾性検索インデックスのクローンを作成しようとしています。それを行う方法を見つけることができませんでした。私がしたいのは、既存のインデックスをマッピングではなくデータで複製することだけです。すべてのマッピングを持つ弾性検索インデックスのクローン

誰かが私を正しい方向に向けることができますか?

答えて

0

これは1ライナーではありませんが、これはelasticsearch-python moduleがあり、マッピングのみに気をつけている場合に有効です。

from elasticsearch import Elasticsearch 

eshost = <YOUR ELASTICSEARCH HOST> 
oldindex = <SOURCE INDEX TO COPY> 
newindex = <NEW INDEX> 

es = Elasticsearch(eshost) 

createReply = es.indices.create(index=newindex) 
getReplySource = es.indices.get_mapping(index=oldindex) 

sourceMappings = getReplySource[oldindex]['mappings'] 
for doc_type, mapping in sourceMappings.iteritems(): 
    putReplyTarget = es.indices.put_mapping(doc_type, mapping, newindex) 
関連する問題