使用图形化界面来实现Elasticsearch的日常管理,最常用的就是Head插件
下载地址 https://github.com/mobz/elasticsearch-head
步骤1:安装nodejs,安装cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
步骤2:将grunt安装为全局命令(grunt是基于Node.js的项目构建工具,可以自动运行所设定的任务)
npm install -g grunt-cli
步骤3:安装依赖
cnpm install
步骤4:进入head目录启动head,在命令提示符下输入命令
grunt server
点击连接按钮没有任何响应,报错信息No ‘Access-Control-Allow-Origin’ header is present on the requested resource.这个错误是由于elasticsearch默认不允许跨域调用,而elasticsearch-head是属于前端工程,所以报错。
步骤5:修改elasticsearch的配置,让其允许跨域访问(增加以下两句命令)
http.cors.enabled: true
http.cors.allow-origin: "*"
重启elasticsearch后点击连接
Head插件操作
新建索引