1、安装ES、PostMan
2、安装IK分词器,目录如下:注意新建目录:analysis-ik
3、启动ES
4、启动PostMan
5、配置请求头,请求体,请求时有两种分词效果:一种是ik_max_word(最大分词)和ik_smart(最小分词),下面是最小分词
5、请求结果如下:
{
"tokens": [
{
"token": "2020年",
"start_offset": 0,
"end_offset": 5,
"type": "TYPE_CQUAN",
"position": 0
},
{
"token": "的",
"start_offset": 5,
"end_offset": 6,
"type": "CN_CHAR",
"position": 1
},
{
"token": "四月份",
"start_offset": 6,
"end_offset": 9,
"type": "CN_WORD",
"position": 2
},
{
"token": "中国",
"start_offset": 9,
"end_offset": 11,
"type": "CN_WORD",
"position": 3
},
{
"token": "终于",
"start_offset": 11,
"end_offset": 13,
"type": "CN_WORD",
"position": 4
},
{
"token": "举",
"start_offset": 13,
"end_offset": 14,
"type": "CN_CHAR",
"position": 5
},
{
"token": "全国",
"start_offset": 14,
"end_offset": 16,
"type": "CN_WORD",
"position": 6
},
{
"token": "之力",
"start_offset": 16,
"end_offset": 18,
"type": "CN_WORD",
"position": 7
},
{
"token": "战",
"start_offset": 18,
"end_offset": 19,
"type": "CN_CHAR",
"position": 8
},
{
"token": "胜了",
"start_offset": 19,
"end_offset": 21,
"type": "CN_WORD",
"position": 9
},
{
"token": "新",
"start_offset": 21,
"end_offset": 22,
"type": "CN_CHAR",
"position": 10
},
{
"token": "冠",
"start_offset": 22,
"end_offset": 23,
"type": "CN_CHAR",
"position": 11
},
{
"token": "病毒",
"start_offset": 23,
"end_offset": 25,
"type": "CN_WORD",
"position": 12
}
]
}