Easysearch、Elasticsearch 还是 Opensearch,是个问题

ES批量建立索引失败,报错request body is required type=parse_exception

Elasticsearch | 作者 DRose | 发布于2020年04月27日 | 阅读数:11278

我按照官网的示例,在执行批量插入索引的时候,一直插入失败。
官网示例地址:https://www.elastic.co/guide/e ... .html
运行环境
ES:7.6.2
Mac:10.14.1
 
启动三个实例:
cd elasticsearch-7.6.2/bin
./elasticsearch
./elasticsearch -Epath.data=data2 -Epath.logs=log2
./elasticsearch -Epath.data=data3 -Epath.logs=log3
curl -H "Content-Type: application/json" -XPOST "localhost:9200/bank/_bulk?pretty&refresh" --data-binary "@accounts.json"
返回结果:
{
"error" : {
"root_cause" : [
{
"type" : "parse_exception",
"reason" : "request body is required"
}
],
"type" : "parse_exception",
"reason" : "request body is required"
},
"status" : 400
}
已邀请:

DRose

赞同来自:

wget https://github.com/elastic/ela ... Dtrue
下载的文件为account.json?raw=true,所以执行上述批量建索引出错。
curl -H "Content-Type: application/json" -XPOST "localhost:9200/bank/_bulk?pretty&refresh" --data-binary "@accounts.json?raw=true"

mv accounts.json?raw=true accounts.json
curl -H "Content-Type: application/json" -XPOST "localhost:9200/bank/_bulk?pretty&refresh" --data-binary "@accounts.json"

要回复问题请先登录注册