我以前有 ElasticSearch 5.2,刚刚升级到 6.0。
我正尝试按照指南 here 创建索引模板, 但出现错误
Content-Type header [application/x-www-form-urlencoded] is not supported
我的查询是
curl -X PUT localhost:9200/_template/template_1 -d '
{
"index_patterns": ["te*", "bar*"],
"mappings": {
"type1": {
"properties": {
"host_name": {
"type": "keyword"
}
}
}
}
}'
最佳答案
要解决此问题,请添加 curl 选项 -H 'Content-Type: application/json'
此错误是由于 ElasticSearch 6.0 中引入的严格内容类型检查引起的,如 this post 中所述
Starting from Elasticsearch 6.0, all REST requests that include a body must also provide the correct content-type for that body.
关于elasticsearch - Elasticsearch 不支持内容类型 header [application/x-www-form-urlencoded],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47544966/