相关疑难解决方法(0)

不支持ElasticSearch - Content-Type标头[application/x-www-form-urlencoded]

我以前有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)

curl content-type http-put mime-types elasticsearch

107
推荐指数
3
解决办法
6万
查看次数

WINDOWS RESTful服务上的cURL POST命令行

我的问题: 使用命令行工具卷曲我的本地主机服务器,同时发送一些数据和我的POST请求不起作用.

似乎导致错误的原因: 想象一下这样的事情

  1. curl -i -X POST -H 'Content-Type: application/json' -d '{"data1": "data goes here", "data2": "data2 goes here"}' http:localhost/path/to/api

返回数据的结果

curl: (6) Could not resolve host: application; No data record of requested type
curl: (6) Could not resolve host: data goes here,; No data record of requested type
curl: (6) Could not resolve host: data2; No data record of requested type
curl: (3) [globbing] unmatched close brace/bracket at pos 16
Run Code Online (Sandbox Code Playgroud)

经过一番搜索,我发现问题不能是用于请求的sintax,因为它适用于UNIX shell.

你可能在使用Windows吗?这看起来像一个完全破坏的shell,不能正确处理单引号和双引号.我刚试过那个命令行,它在我的linux机箱上工作正常. http://curl.haxx.se/mail/archive-2011-03/0066.html

我试图解决那些"逃避它"的问题,但它仍然没有奏效

2.

curl -i …

windows api post command-line curl

57
推荐指数
5
解决办法
11万
查看次数