ES批量增加索引报错【newline】

gitbub源文件,貌似不能直接下载,复制下来,比较恶心:
https://github.com/elastic/elasticsearch/blob/master/docs/src/test/resources/accounts.json

window  cmd命令请求:@后面加上路径和文件 修改自己的虚拟机访问访问地址和端口号
C:\Users\haoha>curl -H "Content-Type: application/json" -XPOST "192.168.23.14:9200/bank/_bulk?pretty&refresh" --data-binary "@C:\Users\haoha\Desktop\accounts.json"

附带加上:GET _cat/health?v  这个咋请求的: 请求ip:port   即可  http://192.168.23.14:9200/_cat/health?v






"reason" : "The bulk request must be terminated by a newline [\\n]"
curl -H "Content-Type: application/json" -XPOST "192.168.23.14:9200/bank/_bulk?pretty&refresh" --data-binary "@accounts.json"

具体为es部分:

URL: https://www.elastic.co/guide/en/elasticsearch/reference/current/getting-started-index.html

 

The bulk request must be terminated by a newline [\\n]

报错说的就是文件必须以新的行结束【说白了要空一行,坑】,就是这么简单

 

附上account.json文件内容,字数太多,不让我弄【只能自己去github上去复制咯,或者更高级的玩法,还有的话留言一下】

{"index":{"_id":"995"}}
{"account_number":995,"balance":21153,"firstname":"Phelps","lastname":"Parrish","age":25,"gender":"M","address":"666 Miller Place","employer":"Pearlessa","email":"phelpsparrish@pearlessa.com","city":"Brecon","state":"ME"}

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值