不要急,总有办法的

全文检索场景,ES7打分耗时比ES5打分耗时长

匿名 | 发布于2021年03月15日 | 阅读数:1812

环境:
  ES7版本:ES7.7.1
  ES5版本:ES5.6.7
  分片情况:分片5个,副本分片2个
  分词器:resource.global_title.zh-CN属性使用 ik分词器
  ES7、ES5数据量级相同:1500+w,ES7中的数据从ES5中reindex而来
  服务器参数一致
检索语句:
{
"from": 0,
"size": 21,
"query": {
"bool": {
"filter": [
{
"bool": {
"must": [
{
"terms": {
"code": [
"coursewares"
]
}
}
],
"filter": [
{
"term": {
"status": {
"value": "ONLINE"
}
}
}
]
}
}
],
"should": [
{
"function_score": {
"query": {
"multi_match": {
"query": "部编人教版一年级语文下册11课彩虹的教案",
"fields": [
"resource.global_title.zh-CN^1.0",
"words.zh-CN^0.05"
],
"type": "best_fields",
"operator": "OR",
"slop": 0,
"prefix_length": 0,
"max_expansions": 50,
"lenient": false,
"zero_terms_query": "NONE",
"boost": 1.0
}
},
"functions": [
{
"filter": {
"bool": {
"must": [
{
"term": {
"tag": {
"value": "$ON0201100"
}
}
},
{
"term": {
"tag": {
"value": "$SB01100"
}
}
}
]
}
},
"weight": 5.0
}
],
"score_mode": "sum",
"boost_mode": "sum",
"max_boost": 3.4028235e38,
"boost": 1.0
}
}
],
"adjust_pure_negative": true,
"minimum_should_match": "1",
"boost": 1.0
}
},
"_source": {
"includes": [
"container_id",
"id",
"tenant_id"
],
"excludes": []
},
"sort": [
{
"_score": {
"order": "desc"
}
}
]
}

用profile分析,问题 ES7的打分耗时 比 ES5的打分耗时长,这是什么原因导致的:
ES7的打分耗时
25.8ms

01.png

 
ES5 打分耗时
5.9ms

02.png

 
 
已邀请:

medcl - 今晚打老虎。

赞同来自: yongde xzy

es7 有不少索引都放堆外了,可能有些影响。你测试的时候预热了么?

要回复问题请先登录注册