在弹性搜索中加载样本数据集时出错 [英] Error loading sample dataset in Elastic search

查看:81
本文介绍了在弹性搜索中加载样本数据集时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试加载示例数据集



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 ,地址: 842 Fountain Avenue ,雇主: Bitrex,电子邮件: susanamoody@bitrex.com,城市: Temperanceville,州: TN}
{ index:{ _ id : 748}}
{ account_number:748, balance:38060, firstname: Ford, lastname: Branch, age:25, gender: M,地址: 926 Cypress Avenue,雇主: Buzzness,电子邮件: fordbranch@buzzness.com, city: Beason, state: DC}
{ index:{ _ id: 750}}

我有还引用了 ES的批量API文档



我能够创建单个索引,但是由于未知原因,我无法为批量文档建立索引。

解决方案

这是因为 accounts.json 文件不可读取,原因是权限/所有者错误,或者不在当前工作目录中。



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

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

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


Hi I am trying to load a sample data set referring elastic search docs but when I am trying to run the instructed command, I am getting the below error. I have read all documents but I am unable to resolve it.

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

First few lines in accounts.json is:-

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

I have also referred Bulk API doc of ES

I am able to create single index but due to unknown reasons I am not able to index bulk documents.

解决方案

This is because the accounts.json file is not available for reading, either because it has the wrong permissions/owner or because it is not in your current working directory.

First, locate the file on your filesystem, to check if it is definitely in your current working dir, type ls -al accounts.json (if you're using windows you should probably use dir accounts.json /Q) and make sure it has read permissions, then provide the full path via the curl command, for example:

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

The reason I'm sure this is the issue is because I get the same error message when I try to POST a non-existing file.

这篇关于在弹性搜索中加载样本数据集时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆