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


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



相关文章
|
1月前
|
存储 JSON 自然语言处理
es索引文档过程
Elasticsearch 索引文档流程:先通过 REST API 或客户端创建索引,定义文档结构的映射;接着索引 JSON 格式的文档,Elasticsearch 解析、索引并存储;最后,文档以倒排索引形式存储,支持高效全文搜索。
40 5
|
6月前
|
缓存 索引
kibana上执行ES DSL语言查询数据并查看表结构与数据、删除索引、查看文件大小
kibana上执行ES DSL语言查询数据并查看表结构与数据、删除索引、查看文件大小
301 0
|
8月前
|
存储 Unix 索引
ES常用查询命令
ES常用查询命令
|
8月前
|
存储
ES批量写入数据
ES批量写入数据
287 1
|
8月前
|
JSON 数据格式
es批量插入文件中的数据
es批量插入文件中的数据
|
8月前
|
前端开发 JavaScript
ES6中 对象合并
ES6中 对象合并
55 0
|
JSON 移动开发 NoSQL
【ES系列九】——批量同步数据至ES
通过es官网提供的bulk方法进行实现
|
前端开发 JavaScript
ES6 对象合并
ES6 对象合并
195 0
|
SQL 数据库管理
【SQL开发实战技巧】系列(九):一个update误把其他列数据更新成空了?Merge改写update!给你五种删除重复数据的写法!
本篇文章讲解的主要内容是:***你有没有经历过一个update把其他列数据清空了、使用merge更新合并记录、删除违反参照完整性的记录、给你五种删除重复数据的写法*** 【SQL开发实战技巧】这一系列博主当作复习旧知识来进行写作,毕竟SQL开发在数据分析场景非常重要且基础,面试也会经常问SQL开发和调优经验,相信当我写完这一系列文章,也能再有所收获,未来面对SQL面试也能游刃有余~。
【SQL开发实战技巧】系列(九):一个update误把其他列数据更新成空了?Merge改写update!给你五种删除重复数据的写法!
|
关系型数据库 MySQL Python
一日一技:MySQL批量插入内容但是遇到重复就覆盖
一日一技:MySQL批量插入内容但是遇到重复就覆盖
212 0