ES-Head 连接Elasticsearch7.1.1 错误 406

# 1. 页面数据查询报 406 错误

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

# 2. 解决方法:

1
2
3
# 进入docker es-head容器
# 命令 docker exec -it 容器ID /bin/bash
[root@localhost ~]# docker exec -it es-head /bin/bash
  1. 进入 head 安装目录;

  2. cd 进入_site / 目录,编辑 vendor.js 共有两处

1
2
# 如果提示找不到vim方法,请参考下面的 [附: Docker容器vim安装]
[root@localhost ~]# vim _site/vendor.js

6886 行: /contentType: "application/x-www-form-urlencoded 改成

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

7573 行: var inspectData = s.contentType === “application/x-www-form-urlencoded” && 改成

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

# 3. 附: Docker 容器 vim 安装

1
2
3
4
# 更新源
[root@localhost ~]# apt-get update
# 先更新,防止提示:Unable to locate package vim
[root@localhost ~]# apt-get install vim