您的位置:首页 > 编程语言 > Python开发

python脚本重建索引

2016-10-27 00:00 381 查看
转载自:http://blog.csdn.net/zy911016/article/details/52191261

平滑重建索引需使用别名,请参考:http://blog.csdn.net/dm_vincent/article/details/41643793

python

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) #重建索引
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: