1.去官网下载所需的版本和插件
红色方框内重复不用管。
![](https://img.haomeiwen.com/i5065466/a99215cd1b6a9e3b.png)
解压elasticsearch7.6
运行 ./bin/elasticsearch.bat
访问:http://127.0.0.1:9200
![](https://img.haomeiwen.com/i5065466/f2a01e5f27c56dfe.png)
编辑elasticsearch.yml
文件末尾追加
http.cors.enabled: true
http.cors.allow-origin: "*"
用于跨域解决,head插件使用!
安装head插件
cd elasticsearch-head
npm install
npm run start
访问http://127.0.0.1:9100
![](https://img.haomeiwen.com/i5065466/20d1cfc8d7bd8efc.png)
安装中文分词elasticsearch-analysis-ik-7.6.0
解压压缩文件,重命名为'ik' 移动到
![](https://img.haomeiwen.com/i5065466/8bb93362743f2343.png)
重启elasticsearch生效。
配置用户名密码
xpack.security.enabled: true
xpack.license.self_generated.type: basic
xpack.security.transport.ssl.enabled: true
设置密码
bin/elasticsearch-setup-passwords interactive
修改密码
curl -H "Content-Type:application/json" -XPOST -u elastic 'http://127.0.0.1:9200/_xpack/security/user/elastic/_password' -d '{ "password" : "123456" }'
网友评论