ES dump拷贝

267 阅读1分钟

拷贝类型

--type=data		拷贝数据
--type=mapping  拷贝映射
--type=analyzer 拷贝analyzer分词

拷贝数据

elasticdump --input=http://localhost:9200/index --output=index.json --type=data

粘贴数据

elasticdump --input index.json --output "http://localhost:9200/index"

压缩

elasticdump 压缩查询结果 据说可能超过10倍压缩率
  --input=http://production.es.com:9200/my_index \
  --output=$ \
  | gzip > /data/my_index.json.gz

备份查询结果

elasticdump \
  --input=http://production.es.com:9200/my_index \
  --output=query.json \
  --searchBody '{"query":{"term":{"username": "admin"}}}'