轉載自:http://blog.csdn.net/zy911016/article/details/52191261python
平滑重建索引需使用別名,請參考:http://blog.csdn.net/dm_vincent/article/details/41643793elasticsearch
python.net
from elasticsearch import Elasticsearch from elasticsearch import helpers es_src=Elasticsearch(host_src) #原索引所在ES集羣的host es_des=Elasticsearch(host_des) #新索引所在ES集羣的host body={"query":{"match_all":{}}} #遍歷原索引 helpers.reindex(client=es_src,source_index='wechat',target_index='wechat_new',target_client=es_des,query=body,chunk_size=1000) #重建索引