elasticsearch dump 教程

本文介绍如何下载并安装Elasticsearch-dump,详细步骤包括下载、解压和配置命令,同时提供数据导出与导入实例,涉及mapping和data类型的导出导入操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

下载安装

首先需要自行下载并安装node。
然后下载elasticsearch-dump,elasticsearch-dump-master.tar.gz然后解压:tar -xvf elasticsearch-dump-master.tar.gz -C ~/app/
然后执行sudo ln -s /home/iie4bu/app/elasticsearch-dump-master/bin/elasticdump /usr/local/bin/,这样就可以直接使用elasticdump

命令

导出数据,包括mapping和data

elasticdump --input http://192.168.171.45:9201/people --output=/mnt/sdb/people-mapping.json --type=mapping
elasticdump --input http://192.168.171.45:9201/people --output=/mnt/sdb/people-data.json --type=data

导入数据

导入的数据格式为:

{"_index": "test", "_type": "_doc", "_id": "9487135226108073440", "_score": null, "_source": {"name": "tom", "age": 17}}
{"_index": "test", "_type": "_doc", "_id": "9487135226123423444", "_score": null, "_source": {"name": "tom", "age": 10}}
{"_index": "test", "_type": "_doc", "_id": "9487135226145768945", "_score": null, "_source": {"name": "tom", "age": 18}}
{"_index": "test", "_type": "_doc", "_id": "9487135226108045678", "_score": null, "_source": {"name": "tom", "age": 19}}

导入命令

./elasticdump --input="./data.json" --output="http://10.26.120.51:9200/{索引名}/{type}" 

在命令中如果输入{索引名}{type},那么就会覆盖文件里面的{索引名}{type}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值