全文检索技术_IK分词器7.7.1版本的安装

本文介绍了如何在Linux环境下安装Elasticsearch的IK分词器7.7.1版本。首先,将分词器下载并解压到Elasticsearch的指定目录,然后重启服务。最后,通过验证示例展示了分词器成功将中文和英文词汇正确分词。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. 在linux系统中,首先将将IK分词器下载下来

wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.7.1/elasticsearch-analysis-ik-7.7.1.zip

将文件加压到Elasticsear安装目录的plugin/analysis-ik下

unzip elasticsearch-analysis-ik-7.7.1.zip -d /usr/share/elasticsearch/plugins/analysis-ik

2. 重启Elasticsearch服务

systemctl restart elsaticsearch.service

3. 验证IK分词器

curl -H 'Content-Type: application/json'  -XGET 'localhost:9200/_analyze?pretty' -d '{"analyzer":"ik_max_word","text":"赵利文的优快云博客内容最近更新挺频繁"}'

结果:

{ “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” : 3,
“type” : “CN_CHAR”,
“position” : 2
},
{
“token” : “的”,
“start_offset” : 3,
“end_offset” : 4,
“type” : “CN_CHAR”,
“position” : 3
},
{
“token” : “csdn”,
“start_offset” : 4,
“end_offset” : 8,
“type” : “ENGLISH”,
“position” : 4
},
{
“token” : “博客”,
“start_offset” : 8,
“end_offset” : 10,
“type” : “CN_WORD”,
“position” : 5
},
{
“token” : “内容”,
“start_offset” : 10,
“end_offset” : 12,
“type” : “CN_WORD”,
“position” : 6
},
{
“token” : “最近”,
“start_offset” : 12,
“end_offset” : 14,
“type” : “CN_WORD”,
“position” : 7
},
{
“token” : “更新”,
“start_offset” : 14,
“end_offset” : 16,
“type” : “CN_WORD”,
“position” : 8
},
{
“token” : “挺”,
“start_offset” : 16,
“end_offset” : 17,
“type” : “CN_CHAR”,
“position” : 9
},
{
“token” : “频繁”,
“start_offset” : 17,
“end_offset” : 19,
“type” : “CN_WORD”,
“position” : 10
} ] }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值