将json数据导入弹性时,Content-Type标头[application / x-www-form-urlencoded]不支持错误

问题描述 投票:1回答:1

我的代码如下

curl -XPOST "http://localhost:9200/test/p
ost/_bulk/"  -d @City_collection.json

错误:{“error”:“Content-Type标头[application / x-www-form-urlencoded]不支持ed”,“status”:406}

elasticsearch
1个回答
2
投票

您需要像这样指定内容类型标头

curl -XPOST "http://localhost:9200/test/post/_bulk/" -H "Content-Type: application/json" -d @City_collection.json
                                                                ^
                                                                |
                                                            add this
© www.soinside.com 2019 - 2024. All rights reserved.