【发布时间】:2017-02-15 01:53:44
【问题描述】:
您好,我正在尝试加载示例数据集 referring elastic search docs,但是当我尝试运行指示的命令时,出现以下错误。我已阅读所有文件,但无法解决。
$ curl -XPOST 'localhost:9200/bank/account/_bulk?pretty' --data-binary @accounts.json
Warning: Couldn't read data from file "accounts.json", this makes an empty
Warning: POST.
{
"error" : {
"root_cause" : [ {
"type" : "parse_exception",
"reason" : "Failed to derive xcontent"
} ],
"type" : "parse_exception",
"reason" : "Failed to derive xcontent"
},
"status" : 400
}
accounts.json 中的前几行是:-
{"account_number":736,"balance":28677,"firstname":"Rogers","lastname":"Mcmahon","age":21,"gender":"F","address":"423 Cameron Court","employer":"Brainclip","email":"rogersmcmahon@brainclip.com","city":"Saddlebrooke","state":"FL"}
{"index":{"_id":"743"}}
{"account_number":743,"balance":14077,"firstname":"Susana","lastname":"Moody","age":23,"gender":"M","address":"842 Fountain Avenue","employer":"Bitrex","email":"susanamoody@bitrex.com","city":"Temperanceville","state":"TN"}
{"index":{"_id":"748"}}
{"account_number":748,"balance":38060,"firstname":"Ford","lastname":"Branch","age":25,"gender":"M","address":"926 Cypress Avenue","employer":"Buzzness","email":"fordbranch@buzzness.com","city":"Beason","state":"DC"}
{"index":{"_id":"750"}}
我也提到了Bulk API doc of ES
我能够创建单个索引,但由于未知原因,我无法为批量文档编制索引。
【问题讨论】:
-
您确定accounts.json 文件在您当前的文件夹中吗?你能显示它包含的前几行吗?
-
我只从 ES 站点下载了示例 json,所以我认为不会有任何错误。
-
你错过了应该是
{"index":{"_id":"742"}}的第一行 -
我从 ES 文档下载的 json 文件只有上面只是来自 accounts.json 的随机数据行你可以从这个链接elastic.co/guide/en/elasticsearch/reference/current/…查看原始 json 文件 urself
-
很奇怪,因为它非常适合我。您在 elasticsearch 日志中看到了什么?
标签: elasticsearch