es批量插入文件中的数据

简介: es批量插入文件中的数据

插入命令


在命令行中执行

curl -H "Content-Type: application/json" -XPOST "127.0.0.1:9200/bank/_bulk?pretty&refresh" --data-binary "@accounts.json"


准备文件accounts.json


{"index":{"_id":"1"}}
{"account_number":1,"balance":39225,"firstname":"Amber","lastname":"Duke","age":32,"gender":"M","address":"880 Holmes Lane","employer":"Pyrami","email":"amberduke@pyrami.com","city":"Brogan","state":"IL"}
{"index":{"_id":"6"}}
{"account_number":6,"balance":5686,"firstname":"Hattie","lastname":"Bond","age":36,"gender":"M","address":"671 Bristol Street","employer":"Netagy","email":"hattiebond@netagy.com","city":"Dante","state":"TN"}
{"index":{"_id":"13"}}
{"account_number":13,"balance":32838,"firstname":"Nanette","lastname":"Bates","age":28,"gender":"F","address":"789 Madison Street","employer":"Quility","email":"nanettebates@quility.com","city":"Nogal","state":"VA"}
{"index":{"_id":"18"}}
{"account_number":18,"balance":4180,"firstname":"Dale","lastname":"Adams","age":33,"gender":"M","address":"467 Hutchinson Court","employer":"Boink","email":"daleadams@boink.com","city":"Orick","state":"MD"}
{"index":{"_id":"20"}}
{"account_number":20,"balance":16418,"firstname":"Elinor","lastname":"Ratliff","age":36,"gender":"M","address":"282 Kings Place","employer":"Scentric","email":"elinorratliff@scentric.com","city":"Ribera","state":"WA"}
{"index":{"_id":"25"}}
{"account_number":25,"balance":40540,"firstname":"Virginia","lastname":"Ayala","age":39,"gender":"F","address":"171 Putnam Avenue","employer":"Filodyne","email":"virginiaayala@filodyne.com","city":"Nicholson","state":"PA"}
{"index":{"_id":"32"}}


在kibanna中查询GET bank/_search


可以看到刚才导入的数据。



相关文章
|
2月前
|
存储 Unix 索引
ES常用查询命令
ES常用查询命令
|
2月前
|
自然语言处理 索引
03_ES数据查询操作
03_ES数据查询操作
58 0
|
2月前
|
存储
ES批量写入数据
ES批量写入数据
120 1
|
2月前
|
JSON 数据格式
es批量插入文件中的数据
es批量插入文件中的数据
|
2月前
|
消息中间件 Java Kafka
使用bboss往es中插入数据
使用bboss往es中插入数据
|
2月前
|
API 开发工具 网络架构
springtboot 操作es
springtboot 操作es
|
9月前
|
索引
如何在已创建的 es 索引中增加分片
如何在已创建的 es 索引中增加分片
|
12月前
|
JSON 移动开发 NoSQL
【ES系列九】——批量同步数据至ES
通过es官网提供的bulk方法进行实现
ES6中&&和 __ 鲜为人知的骚操作
ES6中&&和 __ 鲜为人知的骚操作
94 0
|
测试技术 索引
ES数据删除优化
分享一下ES数据删除优化的相关经历,根据业务需要一共优化了3次,包含了其中踩到的坑和一些花时间解决的问题.
912 0