我正在关注 elasticsearch 的这个链接。
https://www.elastic.co/blog/a-practical-introduction-to-elasticsearch
我正在尝试按照 curl 发布 json 数据。
curl -XPOST "http://localhost:9200/shakespeare/_bulk?pretty" --data-binary @D:\data\shakespeare.json
但是我得到如下错误:
{
"error" : "Content-Type header [application/x-www-form-urlencoded] is not supported",
"status" : 406
}
最佳答案
需要在header中设置content type为application/json:
curl -XPOST -H "Content-Type: application/json" "http://localhost:9200/shakespeare/_bulk?pretty" --data-binary @D:\data\shakespeare.json
关于elasticsearch - 不支持内容类型 header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51378099/