我正在做的是#34;莎士比亚教程"对于弹性搜索。 elasticsearch实例在AWS上设置,如下所示:
{
"_shards" : {
"total" : 40,
"successful" : 20,
"failed" : 0
},
"_all" : {
"primaries" : { },
"total" : { }
},
"indices" : {
"rentalyield" : {
"primaries" : { },
"total" : { }
},
"yield" : {
"primaries" : { },
"total" : { }
},
"r" : {
"primaries" : { },
"total" : { }
},
"shakespeare" : {
"primaries" : { },
"total" : { }
}
}
}
我创建了一张地图如下:
curl -XPUT http://localhost:9200/shakespeare -d '
{
"mappings" : {
"_default_" : {
"properties" : {
"speaker" : {"type": "string", "index" : "not_analyzed" },
"play_name" : {"type": "string", "index" : "not_analyzed" },
"line_id" : { "type" : "integer" },
"speech_number" : { "type" : "integer" }
}
}
}
}
';
shakespeare.json文件位于我的本地计算机上,也位于AWS上的S3上,所以我尝试过:
curl -XPUT localhost:9200/_bulk --data-binary @shakespeare.json
失败并显示以下错误消息:
Warning: Couldn't read data from file "shakespeare.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}
我也尝试过:
curl -XPOST localhost:9200/shakespeare/type/_bulk?pretty=true --data-binary @https://s3-us-west-2.amazonaws.com/richjson/shakespeare.json
产生相同的错误。
我该如何正确地做到这一点?