提问:布和纸怕什么?

function_score导致高亮失效

Elasticsearch | 作者 dongkaihuahit | 发布于2020年09月24日 | 阅读数:2181

使用function_score计算得分后,高亮不显示
简化后的查询代码如下:
{
"from": 0,
"size": 5,
"query": {
"function_score": {
"query": {
"script_score": {
"query": {
"bool": {
"must": [{
"bool": {
"should": [{
"match_phrase_prefix": {
"title": {
"query": "科技",
"slop": 0,
"max_expansions": 50,
"boost": 10.0
}
}
}],
"adjust_pure_negative": true,
"boost": 1.0
}
}],
"adjust_pure_negative": true,
"boost": 1.0
}
},
"script": {
"source": "return doc['display_time'].value.toInstant().getEpochSecond();",
"lang": "painless",
"params": {
"timeWeight": 0.5,
"timeCover": 3.33E-7,
"scoreWeight": 0.5
}
},
"boost": 1.0
}
},
"functions": ,
"score_mode": "multiply",
"max_boost": 3.4028235E38,
"boost": 1.0
}
},
"track_total_hits": 2147483647,
"highlight": {
"pre_tags": ["<em>"],
"post_tags": ["</em>"],
"require_field_match": false,
"fields": {
"title": {},
"content": {}
}
}
}
查询结果:
{
"_index" : "---",
"_type" : "_doc",
"_id" : "1_2000034311832",
"_score" : 1.60085914E9,
"_source" : {
"title" : "柏堰科技园:防输入、补短板、堵漏洞",
"display_time" : 1600859100000
}
},
没有了高亮的结果,大神们帮我看看哪里出问题了
已邀请:

dongkaihuahit - 活到老,编到老

赞同来自: anthony123

已解决

要回复问题请先登录注册