Elasticsearch之 IK 分词器

针对词条查询(TermQuery),查看默认中文分词器的效果:

[itstar@bigdata111 elasticsearch]$ curl -XGET 'http://bigdata111:9200/_analyze?pretty&analyzer=standard' -d '中华人民共和国'

{
   
  "tokens" : [
    {
   
      "token" : "中",
      "start_offset" : 0,
      "end_offset" : 1,
      "type" : "<IDEOGRAPHIC>",
      "position" : 0
    },

    {
   
      "token" : "华",
      "start_offset" : 1,
      "end_offset" : 2,
      "type" : "<IDEOGRAPHIC>",
      "position" : 1
    },

    {
   
      "token" : "人",
      "start_offset" : 2,
      "end_offset" : 3,
      "type" : "<IDEOGRAPHIC>",
      "position" : 2
    },

    {
   
      "token" : "民",
      "start_offset" : 3,
      "end_offset" : 4,
      "type" : "<IDEOGRAPHIC>",
      "position" : 3
    },

    {
   
      "token" : "共",
      "start_offset" : 4,
      "end_offset" : 5,
      "type" : "<IDEOGRAPHIC>",
      "position" : 4
    },

    {
   
      "token" : "和",
      "start_offset" : 5,
      "end_offset" : 6,
      "type" : "<IDEOGRAPHIC>",
      "position" : 5
    },

    {
   
      "token" : "国",
      "start_offset" : 6,
      "end_offset" : 7,
      "type" : "<IDEOGRAPHIC>",
      "position" : 6
    }
  ]
}

一、IK分词器的安装

1.1 前期准备工作

(1)CentOS联网

配置CentOS能连接外网。Linux虚拟机ping www.baidu.com 是畅通的

(2)jar包准备

1)elasticsearch-analysis-ik-master.zip
(下载地址:https://github.com/medcl/elasticsearch-analysis-ik)
2)apache-maven-3.0.5-bin.tar.gz

1.2 jar包安装

(1)Maven解压、配置 MAVEN_HOME和PATH。

[itstar@bigdata111 software]# tar -zxvf apache-maven-3.0.5-bin.tar.gz -C /opt/module/


[itstar@bigdata111 apache-maven-3.0.5]# sudo vi /etc/profile
<
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值