ElasticSearch搭建完成后准备使用es-head建立索引时发现Content-Type错误了
看一下网络流可知报406 错误

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

解决办法

进入head插件安装目录

编辑/usr/src/app/_site/vendor.js(我的es_Head插件部署在docker容器中,路径作为参考)
修改共有两处:

  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" &&

更多推荐

Elasticsearch-head 请求头 Content-Type header 设置