1. 分词器的安装

./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.2.3/elasticsearch-analysis-ik-6.2.3.zip

NOTE: replace 6.2.3 to your own elasticsearch version

github上面的地址

https://github.com/medcl/elasticsearch-analysis-ik

需要注意安装的版本和对应的elasticsearch相匹配

使用方法:

1> 在ElasticSearch的配置文件config/elasticsearch.yml中的最后一行添加参数 index.analysis.analyzer.default.type: ik,则设置所有索引的默认分词器为ik分词。

2> 也可以通过设置mapping来使用ik分词

2. IK分词器的两种分词模式。

1> ik_max_word: 会将文本做最细粒度的拆分,比如会将"北京邮电大学"拆分,会穷尽各种可能的组合;

{
"tokens":[
{
"token":"北京邮电",
"start_offset":0,
"end_offset":4,
"type":"CN_WORD",
"position":0
},
{
"token":"北京",
"start_offset":0,
"end_offset":2,
"type":"CN_WORD",
"position":1
},
{
"token":"邮电大学",
"start_offset":2,
"end_offset":6,
"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
},
{
"token":"大学",
"start_offset":4,
"end_offset":6,
"type":"CN_WORD",
"position":5
}
]
}

2> ik_smart: 会做最粗粒度的拆分

{
"tokens":[
{
"token":"北京",
"start_offset":0,
"end_offset":2,
"type":"CN_WORD",
"position":0
},
{
"token":"邮电大学",
"start_offset":2,
"end_offset":6,
"type":"CN_WORD",
"position":1
}
]
}

elasticsearch安装中文分词器的更多相关文章

  1. 如何给Elasticsearch安装中文分词器IK

    安装Elasticsearch安装中文分词器IK的步骤: 1. 停止elasticsearch 2.2的服务 2. 在以下地址下载对应的elasticsearch-analysis-ik插件安装包(版 ...

  2. elasticsearch安装中文分词器插件smartcn

    原文:http://blog.java1234.com/blog/articles/373.html elasticsearch安装中文分词器插件smartcn elasticsearch默认分词器比 ...

  3. ElasticSearch安装中文分词器IKAnalyzer

    # ElasticSearch安装中文分词器IKAnalyzer  本篇主要讲解如何在ElasticSearch中安装中文分词器IKAnalyzer,拆分的每个词都是我们熟知的词语,从而建立词汇与文档 ...

  4. ElasticSearch 安装中文分词器

    1.安装中文分词器IK 下载地址:https://github.com/medcl/elasticsearch-analysis-ik 在线下载安装: elasticsearch-plugin.bat ...

  5. ElasticSearch安装中文分词器IK

    1.安装IK分词器,下载对应版本的插件,elasticsearch-analysis-ik中文分词器的开发者一直进行维护的,对应着elasticsearch的版本,所以选择好自己的版本即可.IKAna ...

  6. 如何在Elasticsearch中安装中文分词器(IK)和拼音分词器?

    声明:我使用的Elasticsearch的版本是5.4.0,安装分词器前请先安装maven 一:安装maven https://github.com/apache/maven 说明: 安装maven需 ...

  7. Elasticsearch之中文分词器插件es-ik(博主推荐)

    前提 什么是倒排索引? Elasticsearch之分词器的作用 Elasticsearch之分词器的工作流程 Elasticsearch之停用词 Elasticsearch之中文分词器 Elasti ...

  8. 沉淀再出发:ElasticSearch的中文分词器ik

    沉淀再出发:ElasticSearch的中文分词器ik 一.前言   为什么要在elasticsearch中要使用ik这样的中文分词呢,那是因为es提供的分词是英文分词,对于中文的分词就做的非常不好了 ...

  9. Elasticsearch之中文分词器插件es-ik的自定义热更新词库

    不多说,直接上干货! 欢迎大家,关注微信扫码并加入我的4个微信公众号:   大数据躺过的坑      Java从入门到架构师      人工智能躺过的坑         Java全栈大联盟       ...

随机推荐

  1. BZOJ 2818 GCD 【欧拉函数 || 莫比乌斯反演】

    传送门:https://www.lydsy.com/JudgeOnline/problem.php?id=2818 2818: Gcd Time Limit: 10 Sec  Memory Limit ...

  2. 3springboot:springboot配置文件(配置文件占位符、Profile、配置文件的加载位置)

    1.配置文件占位符 RaandomValuePropertySourcr:配置文件可以使用随机数     ${random.value}    ${random.int}  ${random.long ...

  3. REG小探

    根键名称缩写对照表   常用数据类型

  4. log4net快速使用流程

    以下内容大部分来自这里,对原作者流子表示感谢 1.Nuget安装,当前版本2.0.8 2.创建log4net.config文件,文件内容如下: <?xml version="1.0&q ...

  5. 解决 Visual Studio 2017 打开项目提示项目不兼容

    这应该算是VS2017的一个bug,昨天做好的.net core项目还能好好如初,今天打开就提示项目不兼容,未能加载...... 解决办法也是超级简单,但是往往越简单的办法越是想不到: 右键解决方案, ...

  6. C#XML格式字符串取节点数据

    XML格式的字符串: <xml><return_code><![CDATA[{0}]]></return_code><return_msg> ...

  7. 【题解】洛谷P1120 小木棍(搜索+剪枝+卡常)

    洛谷P1120:https://www.luogu.org/problemnew/show/P1120 思路 明显是搜索题嘛 但是这数据增强不是一星半点呐 我们需要N多的剪枝 PS:需要先删去超出50 ...

  8. 关于swing界面label和button的动态设置文字

    在引入发送验证码功能后,想让button的文本动态变化,发现如下方法并不能做到: int limitSec=10; while(limitSec>0){ sendyzhm.setEnabled( ...

  9. Java中的IO流(三)

    上一篇<Java中的IO流(二)>把学习Java的字符流以及转换流作了一下记录,从本篇开始将把IO流中对文件或文件夹操作的对象File类的学习进行一下记录. 一,File类的构造函数及字段 ...

  10. Oracle行转列,pivot函数和unpivot函数

    pivot函数:行转列函数: 语法:pivot(任一聚合函数 for 需专列的值所在列名 in (需转为列名的值)):unpivot函数:列转行函数: 语法:unpivot(新增值所在列的列名 for ...