elasticsearch-head:5和elasticsearch:6.3.2之后,打开界面连接es时发现数据无法展示。
原因是elasticsearch 6增加了请求头严格校验的原因,并且返回结果是
{
“error” : “Content-Type header [application/x-www-form-urlencoded] is not supported”,
“status” : 406
}
所以我们需要修改一下elasticsearch-head 5的配置文件。
1.编辑文件 vim elasticsearch-head-master/_site/vendor.js
共有两处
1)6886行
contentType: "application/x-www-form-urlencoded
改成
contentType: "application/json;charset=UTF-8"
2)7573行
var inspectData = s.contentType === "application/x-www-form-urlencoded" &&
改成
var inspectData = s.contentType === "application/json;charset=UTF-8" &&
保存退出