
IK 分词器是一个基于正向最大匹配算法(Maximum Matching,简称MM算法)的中文分词工具。它是由中国科学院计算技术研究所的研究所成员开发的,主要面向Java平台。IK 分词器以其高效率和高准确率而受到广泛使用,尤其是在中文自然语言处理领域。
IK 分词器的特点包括:
IK 分词器广泛应用于搜索引擎、文本分析、信息检索等领域,是中文分词工具中的一个优秀选择。
Elasticsearch 插件是一种用于增强 Elasticsearch 核心功能的机制,它们可以添加自定义映射类型、自定义分析器、脚本引擎、发现机制等 。插件可以是官方提供的,也可以是第三方开发者提供的。官方插件通常与 Elasticsearch 版本同步更新,而第三方插件则可能拥有不同的许可协议,并且可能不与 Elasticsearch 版本完全兼容 。
插件的安装可以通过命令行进行,使用elasticsearch-plugin install [plugin_name]
命令来安装指定的插件,也可以通过提供插件的 URL 来安装,或者采用离线安装方式,将插件的 JAR 文件放置到 Elasticsearch 的 plugins 目录下,并重启 Elasticsearch 服务 。安装插件时需要注意插件版本与 Elasticsearch 版本相匹配 。
Elasticsearch 插件包括但不限于中文分词器(如 IK Analyzer 或 Smart Chinese Analysis plugin)、简繁体转换插件(如 elasticsearch-analysis-stconvert)等 。这些插件对于特定语言的处理和数据的分析提供了额外的功能和便利 。
在使用 Elasticsearch 插件时,除了安装之外,还可以使用elasticsearch-plugin list
命令来查看已安装的插件,或者使用elasticsearch-plugin remove [plugin_name]
命令来删除不需要的插件 。
用的就是bin里面的elasticsearch-plugin
插件github地址
https://github.com/infinilabs/analysis-ik
可以直接运行
cd到bin目录
bin/elasticsearch-plugin install https://get.infini.cloud/elasticsearch/analysis-ik/8.4.1
修改上方的版本号
不知道的话,可以直接运行,在报错信息里寻找
https://release.infinilabs.com/
自己去找很容易找到
安装完后可以在plugin文件夹看见

安装完后重启es
一定要看见config,否则换一种方式安装
在Kibana可以调试:左上角图标下方三图标 - Managerment - Dev Tools
| 分词类型 | 释义 |
|---|---|
| standard | es原有的分词器适合英文 |
| ik_max_word | 最细切分 |
| ik_smart | 最小切分 |
GET _analyze{"analyzer": "standard","text": "奔驰E63"}
GET _analyze{"analyzer": "ik_max_word","text": "奔驰E63"}
{"tokens": [{"token": "奔驰","start_offset": 0,"end_offset": 2,"type": "CN_WORD","position": 0},{"token": "e63","start_offset": 2,"end_offset": 5,"type": "LETTER","position": 1},{"token": "e","start_offset": 2,"end_offset": 3,"type": "ENGLISH","position": 2},{"token": "63","start_offset": 3,"end_offset": 5,"type": "ARABIC","position": 3}]}
GET _analyze{"analyzer": "ik_smart","text": "奔驰E63"}
{"tokens": [{"token": "奔驰","start_offset": 0,"end_offset": 2,"type": "CN_WORD","position": 0},{"token": "e63","start_offset": 2,"end_offset": 5,"type": "LETTER","position": 1}]}