天天看點

Elasticsearch-head 請求頭 Content-Type header 設定

ElasticSearch搭建完成後準備使用es-head建立索引時發現Content-Type錯誤了

看一下網絡流可知報406 錯誤

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

解決辦法

進入head插件安裝目錄

  1. 第6886行 ​

    ​/contentType: "application/x-www-form-urlencoded​

    ​ 改為 ​

    ​contentType: "application/json;charset=UTF-8"​

  2. 第7574行 ​

    ​var inspectData = s.contentType === "application/x-www-form-urlencoded" &&​

    ​ 改為 ​

    ​var inspectData = s.contentType === "application/json;charset=UTF-8" &&​