简介:常⻅的中⽂分词器的介绍和使⽤

如果⽤默认的分词器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": "⽕箭明年总冠军" 
 }
收藏 打印