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"}