【发布时间】:2019-08-25 22:36:54
【问题描述】:
我知道 StackOverflow 上已经有类似的问题,但没有一个能解决我当前的问题。
我正在使用ElasticSearch 6.7.0,我目前正在学习它的教程。目前,我被困在this step,这需要我download 一些存储在文件accounts.json 中的示例数据。这是文件的一个小sn-p:
{"index":{"_id":"988"}}
{"account_number":988,"balance":17803,"firstname":"Lucy","lastname":"Castro","age":34,"gender":"F","address":"425 Fleet Walk","employer":"Geekfarm","email":"lucycastro@geekfarm.com","city":"Mulino","state":"VA"}
{"index":{"_id":"990"}}
{"account_number":990,"balance":44456,"firstname":"Kelly","lastname":"Steele","age":35,"gender":"M","address":"809 Hoyt Street","employer":"Eschoir","email":"kellysteele@eschoir.com","city":"Stewartville","state":"ID"}
{"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"}
文件保存在路径C:\Users\Me\Desktop\accounts.json中。
我运行了以下命令,按照教程中的说明:
PS C:\Users\Me\Downloads\curl-7.64.1-win64-mingw\bin> .\curl.exe -H “内容类型:应用程序主机:9200/bank/_doc/_bulk?pretty&refresh” --data-binary "C:\Users\Me\Desktop\accounts.json"
我收到此错误消息:
{
"error" : {
"root_cause" : [
{
"type" : "illegal_argument_exception",
"reason" : "The bulk request must be terminated by a newline [\n]"
}
],
"type" : "illegal_argument_exception",
"reason" : "The bulk request must be terminated by a newline [\n]"
},
"status" : 400
}
为了解决这个问题,我转到文件末尾并按Enter 插入了一个新行。但是,当我再次运行该命令时,出现了相同的错误消息。
我该如何解决这个问题?
【问题讨论】:
-
愚蠢的问题,但您是否在最后添加换行符后保存了文件?
-
@Val 是的,我做到了!
-
使用“@C:\Users\Me\Desktop\accounts.json”而不是“C:\Users\Me\Desktop\accounts.json”
标签: json rest elasticsearch