我正在尝试将Json文件发布到 Elasticsearch 中并面临以下错误
curl -XPOST http://localhost/test-index/doc -H "Content-Type: application/json" -d @test.json
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Rejecting mapping update to [test-index] as the final mapping would have more than 1 type: [_doc, doc]"}],"type":"illegal_argument_exception","reason":"Rejecting mapping update to [test-index] as the final mapping would have more than 1 type: [_doc, doc]"},"status":400}
test.json内容
{
"name":"John Smith",
"age":"38"
}
我错过了什么吗
最佳答案
要使用curl命令将Json数据发布到elasticsearch,可以尝试以下命令:
curl -XPOST http://localhost:9200/test-index/_doc -H "Content-Type: application/json" -d @test.json
您尝试发布Json文件的命令在Postman中可以正常使用。
关于elasticsearch - 使用curl命令将JSON数据发布到 Elasticsearch ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60714443/