ES中安装中文/拼音分词器(IK+pinyin)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ES中安装中文/拼音分词器(IK+pinyin)相关的知识,希望对你有一定的参考价值。
参考技术A ES作为最强大的全文检索工具(没有之一),中英文分词几乎是必备功能,下面简单说明下分词器安装步骤(详细步骤网上很多,本文只提供整体思路和步骤):IK中文分词器: https://github.com/medcl/elasticsearch-analysis-ik
拼音分词器: https://github.com/medcl/elasticsearch-analysis-pinyin
(竟然都是同一个作者的杰作,还有mmseg和简繁转换的类库,依然默默 watch)
** settings配置 **
** mapping 配置 **
通过_analyze测试下分词器是否能正常运行:
向index中put中文数据:
中文分词测试(通过查询字符串)
curl http://localhost:9200/my_index/index_type/_search?q=name :刘
curl http://localhost:9200/my_index/index_type/_search?q=name :刘德
拼音测试 (通过查询字符串)
curl http://localhost:9200/my_index/index_type/_search?q=name.pinyin:liu
curl http://localhost:9200/my_index/index_type/_search?q=name.pinyin:ldh
curl http://localhost:9200/my_index/index_type/_search?q=name.pinyin:de+hua
以上是关于ES中安装中文/拼音分词器(IK+pinyin)的主要内容,如果未能解决你的问题,请参考以下文章