附上 查询脚本:
{
"min_score": 1,
"query": {
"bool": {
"must": [
{
"match": {
"_all": "公积金 "
}
}
]
}
},
"highlight": {
"fields": {
"outAnswer": {
"fragment_size": 2000
},
"innerAnswer": {
"fragment_size": 2000
},
"standardQuestion": {},
"smsAnswer": {},
"kmLikeAskList.askQuestion": {}
},
"post_tags": [
"</em>"
],
"pre_tags": [
"<em style='font-style:normal;color:#c00;'>"
],
"require_field_match": false
}
}
返回结果:
{
"took": 40,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 15,
"max_score": 11.3436775,
"hits": [
{
"_index": "km_problem_v5",
"_type": "km_problem",
"_id": "427049646213828608",
"_score": 10.726344,
"_source": {
"problemId": "427049646213828608",
"pointId": "",
"companyId": "27_84",
"typeId": "426786370636234752",
"outAnswer": "<p>申请住房公积金贷款,应向购房所在地的住房公积金管理机构提出,因此在宁德购房时能否申请住房公积金贷款,请您详询宁德市住房公积金管理机构。若您在宁德购房,若符合公积金提取条件可以申请提取住房公积金贷款,需提交以下材料:1、购买商品房、保障性住房的,提交:(1)购房合同原件;(2)房屋预告登记证明原件及复印件;(3)购房发票原件及复印件;(4)有效身份证原件及复印件;(5)公积金所有权人本市同行住房公积金联名卡或储蓄卡或存折。2、购买二手房的(含拍卖房的),提交:(1)房屋所有权证原件及复印件;(2)房产/土地使用权权属转移涉税证明原件及复印件;(3)有效身份证原件及复印件;(4)公积金所有权人本市同行住房公积金联名卡或储蓄卡或存折。</p>",
"standardQuestion": "公积金异地贷款",
......
}
]
}
}
]
}
}
相关mapping设置:
"outAnswer": {
"include_in_all": true,
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
},
"analyzer": "ik_smart"
},
"standardQuestion": {
"include_in_all": true,
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
},
"analyzer": "ik_smart"
}
......
"_all": {
"store": "false",
"search_analyzer": "ik_smart",
"analyzer": "ik_smart",
"term_vector": "no"
}
....
{
"min_score": 1,
"query": {
"bool": {
"must": [
{
"match": {
"_all": "公积金 "
}
}
]
}
},
"highlight": {
"fields": {
"outAnswer": {
"fragment_size": 2000
},
"innerAnswer": {
"fragment_size": 2000
},
"standardQuestion": {},
"smsAnswer": {},
"kmLikeAskList.askQuestion": {}
},
"post_tags": [
"</em>"
],
"pre_tags": [
"<em style='font-style:normal;color:#c00;'>"
],
"require_field_match": false
}
}
返回结果:
{
"took": 40,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 15,
"max_score": 11.3436775,
"hits": [
{
"_index": "km_problem_v5",
"_type": "km_problem",
"_id": "427049646213828608",
"_score": 10.726344,
"_source": {
"problemId": "427049646213828608",
"pointId": "",
"companyId": "27_84",
"typeId": "426786370636234752",
"outAnswer": "<p>申请住房公积金贷款,应向购房所在地的住房公积金管理机构提出,因此在宁德购房时能否申请住房公积金贷款,请您详询宁德市住房公积金管理机构。若您在宁德购房,若符合公积金提取条件可以申请提取住房公积金贷款,需提交以下材料:1、购买商品房、保障性住房的,提交:(1)购房合同原件;(2)房屋预告登记证明原件及复印件;(3)购房发票原件及复印件;(4)有效身份证原件及复印件;(5)公积金所有权人本市同行住房公积金联名卡或储蓄卡或存折。2、购买二手房的(含拍卖房的),提交:(1)房屋所有权证原件及复印件;(2)房产/土地使用权权属转移涉税证明原件及复印件;(3)有效身份证原件及复印件;(4)公积金所有权人本市同行住房公积金联名卡或储蓄卡或存折。</p>",
"standardQuestion": "公积金异地贷款",
......
}
]
}
}
]
}
}
相关mapping设置:
"outAnswer": {
"include_in_all": true,
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
},
"analyzer": "ik_smart"
},
"standardQuestion": {
"include_in_all": true,
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
},
"analyzer": "ik_smart"
}
......
"_all": {
"store": "false",
"search_analyzer": "ik_smart",
"analyzer": "ik_smart",
"term_vector": "no"
}
....
2 个回复
laoyang360 - 《一本书讲透Elasticsearch》作者,Elastic认证工程师 [死磕Elasitcsearch]知识星球地址:http://t.cn/RmwM3N9;微信公众号:铭毅天下; 博客:https://elastic.blog.csdn.net
赞同来自:
第一步:拿你这篇文章通过smart分词看能获取到“公积金”不?
第二步:如果能?再将你的检索语句最小化,指定字段检索?高亮部分最小化,只加前后匹配词和待高亮字段。
wokeyi
赞同来自: