gpt4 book ai didi

elasticsearch - 在 Elasticsearch 中加载示例数据集时出错

转载 作者:行者123 更新时间:2023-12-02 22:12:46 24 4
gpt4 key购买 nike

您好,我正在尝试加载示例数据集 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
}

enter image description here

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 文件不可读取,因为它的权限/所有者错误或者因为它不在您当前的工作目录中。

首先,在您的文件系统上找到该文件,检查它是否确实在您当前的工作目录中,键入 ls -al accounts.json(如果您使用的是 Windows,您可能应该使用 dir accounts.json/Q) 并确保它具有读取权限,然后通过 curl 命令提供完整路径,例如:

curl -XPOST 'localhost:9200/bank/account/_bulk?pretty' --data-binary "@/home/user/accounts.json"

我确定这是问题所在的原因是因为当我尝试发布一个不存在的文件时收到相同的错误消息。

关于elasticsearch - 在 Elasticsearch 中加载示例数据集时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39893964/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com