使用版本7.10.0
设置密码
elasticsearch-setup-passwords.bat interactive
设置密码的时候,已需要启动ES、且修改密码后,需要重启ES
安装ik插件
elasticsearch-plugin install https://github.com/infinilabs/analysis-ik/releases/download/v7.10.0/elasticsearch-analysis-ik-7.10.0.zip
配置ik,自定义分词文件
elasticsearch-7.10.0\config\analysis-ik\IKAnalyzer.cfg.xml 文件:
启动时,可以看到加载是否成功:
分词优化测试 :
POST /_analyze
{
“analyzer”: “ik_smart“, //或者ik_max_word
“text”: “本地文件包含1鱼叉式网络钓鱼了零日漏洞”
}
elasticpress中使用带密码的elasticsearch的配置:
http://elastic:123456@localhost:9200
提示:failed to authenticate user
[2024-08-15T15:33:19,864][INFO ][o.e.x.s.a.AuthenticationService] [LAPTOP-*] Authentication of [elastic] was terminated by realm [reserved] - failed to authenticate user [elastic]
[2024-08-15T15:33:19,880][ERROR][o.e.x.s.a.e.ReservedRealm] [LAPTOP-*] failed to retrieve password hash for reserved user [elastic]
我是直接删除了/node/目录下的文件夹,导致这个问题,
解决的话:
(1)elasticsearch.yml中将xpack.security.enabled: 值为false
(2)重启进入ES,删除索引:.security-7