关于Elasticsearch6.2.4遇到的问题

环境:Ubuntu14.04 32bit

安装elasticsearch 6.2.4后新建索引时:

curl -X PUT 'localhost:9200/accounts' -d '
{
  "mappings": {
    "person": {
      "properties": {
        "user": {
          "type": "text",
          "analyzer": "ik_max_word",
          "search_analyzer": "ik_max_word"
        },
        "title": {
          "type": "text",
          "analyzer": "ik_max_word",
          "search_analyzer": "ik_max_word"
        },
        "desc": {
          "type": "text",
          "analyzer": "ik_max_word",
          "search_analyzer": "ik_max_word"
        }
      }
    }
  }
}'


返回错误信息如下:

{
  "error" : "Content-Type header [application/x-www-form-urlencoded] is not supported",
  "status" : 406

}

解决方案:

解决方案:

  在原指令中,添加:-H 'Content-Type: application/json'


curl -X PUT 'localhost:9200/accounts?pretty' -H 'Content-Type: application/json' -d '
{              
  "mappings": {
    "person": {
      "properties": {
        "user": {
          "type": "text",
          "analyzer": "ik_max_word",
          "search_analyzer": "ik_max_word"
        },        
        "title": {
          "type": "text",
          "analyzer": "ik_max_word",
          "search_analyzer": "ik_max_word"
        },       
        "desc": {
          "type": "text",
          "analyzer": "ik_max_word",
          "search_analyzer": "ik_max_word"
        }
      }
    }

  }


OK,问题解决!

猜你喜欢

转载自blog.csdn.net/zhangyun75/article/details/80454460
今日推荐