IK分词器是一个中文语言的语言分析器,以下为指定使用“IK分词器”的案例:
在Postman中,向ES服务器发送GET请求:
http://192.168.1.108:9200/_analyze
请求体里面的内容为(在请求体里指定要分析的文本):
- {
- "text":"测试单词"
- }

调用上述接口后,其接口的返回内容为:
- {
- "tokens": [
- {
- "token": "测",
- "start_offset": 0,
- "end_offset": 1,
- "type": "
" , - "position": 0
- },
- {
- "token": "试",
- "start_offset": 1,
- "end_offset": 2,
- "type": "
" , - "position": 1
- },
- {
- "token": "单",
- "start_offset": 2,
- "end_offset": 3,
- "type": "
" , - "position": 2
- },
- {
- "token": "词",
- "start_offset": 3,
- "end_offset": 4,
- "type": "
" , - "position": 3
- }
- ]
- }
ES的默认分词器无法识别中文中“测试”、