1.在https://www.elastic.co/cn/downloads/elasticsearch网站上下载windows 环境zip包,解压。
2.下载nodejs,安装。
3.下载Head配置插件:https://github.com/mobz/elasticsearch-head,解压到第一步elasticsearch包路径下。
4.nodejs安装完后,cmd到nodejs根目录下,输入指令:npm install -g grunt-cli ,等待安装完成。
5.到elasticsearch-head解压路径下,修改Gruntfile.js,在connect-server-options下添加hostname: "*"。

6.修改elasticsearch解压包的config文件夹下的elasticsearch.yml,添加如下代码:
##已存在示例,将注释代码去掉既可
cluster.name: my-application
node.name: node-1
network.host: 0.0.0.0
http.port: 9200
discovery.seed_hosts: ["127.0.0.1"] ##启动elasticsearch.bat闪退后,查看log日志提示需要配置。
cluster.initial_master_nodes: ["node-1"] ##启动elasticsearch.bat闪退后,查看log日志提示需要配置。
http.cors.enabled: true
http.cors.allow-origin: "*"
node.master: true
node.data: true
?7.启动elasticsearch.bat闪退后,查看logs文件夹下的my-application.log日志提示需要配置discovery.seed_hosts,cluster.initial_master_nodes。
8.cmd到elasticsearch-head目录输入命令npm install,若安装报各种关于package.json的解析错误,使用'npm cache clean --force'命令清除缓存再安装。如果报错信息如下:

?就是phantomjs下载不下来,可以去github或者gitee下载。https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-windows.zip
http://npm.taobao.org/dist/phantomjs/
下载后放到C:\Users\DSJ\AppData\Local\Temp\phantomjs\phantomjs-2.1.1-windows.zip。再回到
?elasticsearch-head目录执行npm i --verbose,再执行npm install。
9.接着输入grunt server 启动nodejs,访问?http://localhost:9100
?
|