ElasticSearch(7.2.2)-常⻅中⽂分詞器的使⽤
- 2019 年 11 月 4 日
- 筆記
簡介:常⻅的中⽂分詞器的介紹和使⽤
如果⽤默認的分詞器standard
- POST localhost:9200/_analyze
{ "analyzer": "standard", "text": "⽕箭明年總冠軍" }
常⻅分詞器
- smartCN ⼀個簡單的中⽂或中英⽂混合⽂本的分詞器
- IK分詞器 更智能更友好的中⽂分詞器
smartCn
- 安裝 sh elasticsearch-plugin install analysis-smartcn
- 卸載 sh elasticsearch-plugin remove analysis-smartcn
- 檢驗
- 安裝後重新啟動
- POST localhost:9200/_analyze
{ "analyzer": "smartcn", "text": "⽕箭明年總冠軍" }
IK分詞器
- 下載 https://github.com/medcl/elasticsearch-analysis-ik/releases
- 安裝 解壓安裝到plugins⽬錄
- 檢驗
- 安裝後重新啟動
- POST localhost:9200/_analyze
{ "analyzer": "ik_max_word", "text": "⽕箭明年總冠軍" }