我想测试下 ik 分词后的检索效果,于是创建一个索引:
 
然后我插入了一条测试数据:
 
 
测试查询:
 
 
发现并没有命中数据,但是 hits total 数值为 1,却没有数据返回,于是我试了下标题标题为 docker 容器内的系统时间不正确 的分词结果:
 
 
 
让后再次查询:
 
 
之前的那条数据能够被查询出来,很诡异。。。,初次接触 elasticsearch, 不知道是啥情况,难道是我哪里设置不正确,我用的版本是 5.6.1
 
有知道的前辈能帮帮忙么。
 
 
																
																																																																																
															
														{
  "settings": {
    "number_of_replicas": 0
  },
  "mappings": {
    "question": {
      "dynamic": false,
      "properties": {
        "title": {
          "type": "text",
          "index": "analyzed",
          "analyzer": "ik_smart",
          "search_analyzer": "ik_smart"
        },
        "desc": {
          "type": "text",
          "index": "analyzed",
          "analyzer": "ik_smart",
          "search_analyzer": "ik_smart"
        }
      }
    }
  }
}然后我插入了一条测试数据:
测试查询:
发现并没有命中数据,但是 hits total 数值为 1,却没有数据返回,于是我试了下标题标题为 docker 容器内的系统时间不正确 的分词结果:
{
    "tokens": [
        {
            "token": "docker",
            "start_offset": 0,
            "end_offset": 6,
            "type": "ENGLISH",
            "position": 0
        },
        {
            "token": "容器",
            "start_offset": 7,
            "end_offset": 9,
            "type": "CN_WORD",
            "position": 1
        },
        {
            "token": "内",
            "start_offset": 9,
            "end_offset": 10,
            "type": "CN_CHAR",
            "position": 2
        },
        {
            "token": "的",
            "start_offset": 10,
            "end_offset": 11,
            "type": "CN_CHAR",
            "position": 3
        },
        {
            "token": "系统",
            "start_offset": 11,
            "end_offset": 13,
            "type": "CN_WORD",
            "position": 4
        },
        {
            "token": "时间",
            "start_offset": 13,
            "end_offset": 15,
            "type": "CN_WORD",
            "position": 5
        },
        {
            "token": "不正确",
            "start_offset": 15,
            "end_offset": 18,
            "type": "CN_WORD",
            "position": 6
        }
    ]
}分词看上去并没有什么问题,分词中是有 docker 关键字的,让后我又加了条 title 为 容器内的系统时间不正确 docker 的记录:让后再次查询:
之前的那条数据能够被查询出来,很诡异。。。,初次接触 elasticsearch, 不知道是啥情况,难道是我哪里设置不正确,我用的版本是 5.6.1
有知道的前辈能帮帮忙么。




	
0 个回复