安装IK中文分词器
参考github (https://github.com/medcl/elasticsearch-analysis-ik/tree/v7.6.1)
1.download or compile
optional 1 - download pre-build package from here: https://github.com/medcl/elasticsearch-analysis-ik/releases
create plugin folder cd your-es-root/plugins/ && mkdir ik
unzip plugin to folder your-es-root/plugins/ik
optional 2 - use elasticsearch-plugin to install ( supported from version v5.5.1 ):
./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.3.0/elasticsearch-analysis-ik-6.3.0.zip
NOTE: replace 6.3.0 to your own elasticsearch version
配置
如果你使用ik分词器,其实都为你解决了.但是它默认设置的停用词都是英文的,比如AND,OR等等
配置中文停用词
your/path/elasticsearch/config/analysis-ik
打开它发现会有stopword.dic和extra_stopword.dic, stopword.dic里面的都为配置的英文停用词,而extra_stopword.dic里面的都为配置的中文停用词
配置IKAnalyzer.cfg.xml中
给下面这行加上
extra_stopword.dic
<entry key=“ext_stopwords”>extra_stopword.dic</entry>
停用词
编辑 extra_stopword.dic
加上下面这些停用词。
的
一
不
在
人
有
是
为
以
于
上
他
而
后
之
来
及
了
因
下
可
到
由
这
与
也
此
但
并
个
其
已
无
小
我
们
起
最
再
今
去
好
只
又
或
很
亦
某
把
那
你
乃
它
吧
被
比
别
趁
当
从
到
得
打
凡
儿
尔
该
各
给
跟
和
何
还
即
几
既
看
据
距
靠
啦
了
另
么
每
们
嘛
拿
哪
那
您
凭
且
却
让
仍
啥
如
若
使
谁
虽
随
同
所
她
哇
嗡
往
哪
些
向
沿
哟
用
于
咱
则
怎
曾
至
致
着
诸
自