启动ik分词器和es(要先启动它)后进入控制台,如下图
输入以下内容:
POST /_analyze
{
"text": "es和ik分词器的学习",
"analyzer": "ik_max_word"
}
得到以下结果:
{
"tokens" : [
{
"token" : "es",
"start_offset" : 0,
"end_offset" : 2,
"type" : "ENGLISH",
"position" : 0
},
{
"token" : "和",
"start_offset" : 2,
"end_offset" : 3,
"type" : "CN_CHAR",
"position" : 1
},
{
"token" : "ik",
"start_offset" : 3,
"end_offset" : 5,
"type" : "ENGLISH",
"position" : 2
},
{
"token" : "分词器",
"start_offset" : 5,
"end_offset" : 8,
"type" : "CN_WORD",
"position" : 3
},
{
"token" : "分词",
"start_offset" : 5,
"end_offset" : 7,
"type" : "CN_WORD",
"position" : 4
},
{
"token" : "器",
"start_offset" : 7,
"end_offset" : 8,
"type" : "CN_CHAR",
"position" : 5
},
{
"token" : "的",
"start_offset" : 8,
"end_offset" : 9,
"type" : "CN_CHAR",
"position" : 6
},
{
"token" : "学习",
"start_offset" : 9,
"end_offset" : 11,
"type" : "CN_WORD",
"position" : 7
}
]
}