elasticsearch pinyin 拼音分词器
Posted jiqing9006
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了elasticsearch pinyin 拼音分词器相关的知识,希望对你有一定的参考价值。
安装pinyin分词
地址:https://github.com/medcl/elasticsearch-analysis-pinyin
PUT py_test
{
"index" : {
"analysis" : {
"analyzer" : {
"pinyin_analyzer" : {
"tokenizer" : "my_pinyin",
"filter" : "word_delimiter"
}
},
"tokenizer" : {
"my_pinyin" : {
"type" : "pinyin",
"first_letter" : "none",
"padding_char" : " "
}
}
}
}
}
GET py_test/_analyze
{
"text":"刘德华",
"analyzer":"pinyin_analyzer"
}
得到
{
"tokens": [
{
"token": "liu",
"start_offset": 0,
"end_offset": 1,
"type": "word",
"position": 0
},
{
"token": "ldh",
"start_offset": 0,
"end_offset": 3,
"type": "word",
"position": 0
},
{
"token": "de",
"start_offset": 1,
"end_offset": 2,
"type": "word",
"position": 1
},
{
"token": "hua",
"start_offset": 2,
"end_offset": 3,
"type": "word",
"position": 2
}
]
}
以上是关于elasticsearch pinyin 拼音分词器的主要内容,如果未能解决你的问题,请参考以下文章
Elasticsearch 2.3.x 拼音分词 analysis-lc-pinyin
Elasticsearch 7.X 拼音分词器 pinyin 使用
Elasticsearch 5 Ik+pinyin分词配置详解
Elasticsearch 分布式搜索引擎 -- elasticsearch-analysis-pinyin 拼音分词器的安装和介绍