Bar*_*man 107 curl content-type http-put mime-types elasticsearch
我以前有ElasticSearch 5.2,刚刚升级到6.0.
我试图在这里按照指南创建一个索引模板,但是得到了错误
Content-Type header [application/x-www-form-urlencoded] is not supported
Run Code Online (Sandbox Code Playgroud)
我的疑问是
curl -X PUT localhost:9200/_template/template_1 -d '
{
"index_patterns": ["te*", "bar*"],
"mappings": {
"type1": {
"properties": {
"host_name": {
"type": "keyword"
}
}
}
}
}'
Run Code Online (Sandbox Code Playgroud)
sam*_*sam 195
要解决此问题,请添加curl选项 -H 'Content-Type: application/json'
这个错误是由于严格的内容类型检查在ElasticSearch 6.0中引入,在解释这个岗位
从Elasticsearch 6.0开始,包含正文的所有REST请求也必须为该正文提供正确的内容类型.
解决方法是添加Content-Type: application/json标题
curl -XPUT 'localhost:9200/_template/template_1' \
-H 'Content-Type: application/json' \
-d '**your query**'
Run Code Online (Sandbox Code Playgroud)
小智 5
"{ \"name\": { \"first\": {} }, \"address\": [ { \"address1\":\"lane\" } ] } "
Run Code Online (Sandbox Code Playgroud)
在 Windows 中,当您将 JSON 作为参数提供时,仅使用双引号。使用转义字符。
| 归档时间: |
|
| 查看次数: |
57331 次 |
| 最近记录: |