问题背景
- es 版本调整 导致 请求header 格式需要指定
Content-Type header [application/x-www-form-urlencoded] is not supported
复盘
- 发 put 请求
curl -XPUT 'localhost:9200/customer?pretty&pretty'
- 返回 错误信息
{
"error" : "Content-Type header [application/x-www-form-urlencoded] is not supported",
"status" : 406
}
解决办法
curl -XPUT -H'Content-Type: application/json' 'localhost:9200/customer?pretty&pretty'
- 官网如下
https://www.elastic.co/cn/blog/strict-content-type-checking-for-elasticsearch-rest-requests
文档:
http://doc.codingdict.com/elasticsearch/
http://doc.codingdict.com/elasticsearch/324/
https://www.elastic.co/guide/cn/elasticsearch/guide/current/document.html
https://www.knowledgedict.com/tutorial/elasticsearch-index-settings.html