es ik 多字段查询_ik 分词器和ElasticSearch查询条件

title:百度张亚勤:ABC时代来了,迎战云计算“马拉松”

创建mapping的时候指定了title字段的分词器为ik,分词结果为

{"tokens": [

{

"token": "百度",

"start_offset": 0,

"end_offset": 2,

"type": "CN_WORD",

"position": 0

}

,

{

"token": "百",

"start_offset": 0,

"end_offset": 1,

"type": "TYPE_CNUM",

"position": 1

}

,

{

"token": "度",

"start_offset": 1,

"end_offset": 2,

"type": "COUNT",

"position": 2

}

,

{

"token": "张",

"start_offset": 2,

"end_offset": 3,

"type": "CN_CHAR",

"position": 3

}

,

{

"token": "亚",

"start_offset": 3,

"end_offset": 4,

"type": "CN_WORD",

"position": 4

}

,

{

"token": "勤",

"start_offset": 4,

"end_offset": 5,

"type": "CN_WORD",

"position": 5

}

,

{

"token": "abc",

"start_offset": 6,

"end_offset": 9,

"type": "ENGLISH",

"position": 6

}

,

{

"token": "时代",

"start_offset": 9,

"end_offset": 11,

"type": "CN_WORD",

"position": 7

}

,

{

"token": "来了",

"start_offset": 11,

"end_offset": 13,

"type": "CN_WORD",

"position": 8

}

,

{

"token": "迎战",

"start_offset": 14,

"end_offset": 16,

"type": "CN_WORD",

"position": 9

}

,

{

"token": "战云",

"start_offset": 15,

"end_offset": 17,

"type": "CN_WORD",

"position": 10

}

,

{

"token": "云",

"start_offset": 16,

"end_offset": 17,

"type": "CN_WORD",

"position": 11

}

,

{

"token": "计算",

"start_offset": 17,

"end_offset": 19,

"type": "CN_WORD",

"position": 12

}

,

{

"token": "马拉松",

"start_offset": 20,

"end_offset": 23,

"type": "CN_WORD",

"position": 13

}

,

{

"token": "马拉",

"start_offset": 20,

"end_offset": 22,

"type": "CN_WORD",

"position": 14

}

,

{

"token": "松",

"start_offset": 22,

"end_offset": 23,

"type": "CN_WORD",

"position": 15

}

]}

通过张亚勤或者云计算搜不到内容

查询语句为

{

"query": {

"term": {

"title": "张亚勤"

}

}

}

java代码为

response = client.prepareSearch("blog") .setTypes("article") .setQuery(QueryBuilders.termQuery("title", "张亚勤")) .setFrom(0).setSize(60).setExplain(true) .execute() .actionGet();

问题:ik分词分出来的大部分是两个汉字的,三个汉字就匹配不到了,怎么修改ik的配置,或者改一下查询条件,能够搜到相应的结果?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值