2017-09-27 3 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)