1.安装elasticsearch-head
https://github.com/mobz/elasticsearch-head
git clone git://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head
npm install
npm run start
open http://localhost:9100/
由于elasticsearch-head5.x只有作为一个独立的版本运行,所以访问elasticsearch的时候会出现跨域的问题
2.设置elasticsearch的配置文件
修改elasticsearch的跨域问题,打开elasticsearch.yml,在文件的最后添加
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-methods: GET, POST, PUT, DELETE, OPTIONS
http.cors.allow-headers: "Origin, No-Cache, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type, X-E4M-With"
3.重启elasticsearch
运行结果如图