Elasticsearch-ik分析器

复制代码
CLI 安装步骤
1、停止 Elasticsearch(如果正在运行): 在安装插件之前,确保 Elasticsearch 没有在运行。
命令:
systemctl stop elasticsearch

2、安装插件: 使用 elasticsearch-plugin 命令安装 IK 插件。

进入到你的es的安装目录:如/usr/local/software/elasticsearch
[root@localhost elasticsearch]# bin/elasticsearch-plugin install https://get.infini.cloud/elasticsearch/analysis-ik/8.17.0

其中analysis-ik/8.17.0对应你自己安装es的版本

warning: ignoring JAVA_HOME=/usr/local/software/jdk-21.0.5; using bundled JDK
-> Installing https://get.infini.cloud/elasticsearch/analysis-ik/8.17.0
-> Downloading https://get.infini.cloud/elasticsearch/analysis-ik/8.17.0
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@     WARNING: plugin requires additional permissions     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
* java.net.SocketPermission * connect,resolve
See https://docs.oracle.com/javase/8/docs/technotes/guides/security/permissions.html
for descriptions of what these permissions allow and the associated risks.

Continue with installation? [y/N]y  (此处选择y)
-> Installed analysis-ik
-> Please restart Elasticsearch to activate any plugins installed

3、查看ik分词器是否安装成功
[root@localhost elasticsearch]# curl -X GET "localhost:9200/_cat/plugins?v"
name                  component   version
localhost.localdomain analysis-ik 8.17.0

4、重启 Elasticsearch:

安装完成后,重启 Elasticsearch 使插件生效。

systemctl stop elasticsearch
systemctl start elasticsearch

查看状态
systemctl status elasticsearch

查看日志
journalctl -u elasticsearch -f

5、查看日志载入插件里有个名为:loaded plugin [analysis-ik]

cat /usr/local/software/elasticsearch/logs/elasticsearch.log

[2025-07-25T13:28:57,460][INFO ][o.e.p.PluginsService     ] [localhost.localdomain] loaded plugin [analysis-ik]

我是中国人,的ik分词情况

{
    "tokens": [
        {
            "token": "我",
            "start_offset": 0,
            "end_offset": 1,
            "type": "CN_CHAR",
            "position": 0
        },
        {
            "token": "是",
            "start_offset": 1,
            "end_offset": 2,
            "type": "CN_CHAR",
            "position": 1
        },
        {
            "token": "中国人",
            "start_offset": 2,
            "end_offset": 5,
            "type": "CN_WORD",
            "position": 2
        },
        {
            "token": "中国",
            "start_offset": 2,
            "end_offset": 4,
            "type": "CN_WORD",
            "position": 3
        },
        {
            "token": "国人",
            "start_offset": 3,
            "end_offset": 5,
            "type": "CN_WORD",
            "position": 4
        }
    ]
}
相关推荐
朗心心理27 分钟前
朗心科技:以数智化引领心理健康服务新标杆
大数据·人工智能·科技·心理健康·朗心科技·数智化心理育人·一站式心理中心建设
无忧智库1 小时前
破局与重构:大型集团化协同管理平台的全景式深度解构(PPT)
大数据
码云数智-大飞3 小时前
进程、线程与协程:并发模型的演进与 Go 语言的 GMP 革命
大数据
XiaoMu_0013 小时前
基于大数据的糖尿病数据分析可视化
大数据·数据挖掘·数据分析
阿里云大数据AI技术3 小时前
Celeborn 如何让 EMR Serverless Spark 的 Shuffle 舒心、放心、安心
大数据·spark
AI营销快线4 小时前
AI营销获客难?原圈科技深度解析SaaS系统增长之道
大数据·人工智能
星幻元宇VR5 小时前
VR环保学习机|科技助力绿色教育新模式
大数据·科技·学习·安全·vr·虚拟现实
CryptoPP5 小时前
开发者指南:构建实时期货黄金数据监控系统
大数据·数据结构·笔记·金融·区块链
ZGi.ai6 小时前
生产级 Agent 编排 从单一 LLM 调用到多智能体工作流的工程设计
大数据·数据库·人工智能
天远数科6 小时前
分布式系统实战:基于天远二手车估值API构建高可用车辆估值微服务
大数据·微服务·云原生·架构