是时候用 ES 拯救发际线啦

这个score计算得是不是有问题?

Elasticsearch | 作者 hezhiqiang | 发布于2020年05月26日 | 阅读数:209

搜索条件是这样的:
GET kid_book/_search?search_type=dfs_query_then_fetch
{
"query": {
"bool": {
"must": [
{
"bool": {
"must": [
{
"match": {
"search": "牛津阅读树完整版"
}
}
]
}
},
{
"bool": {
"should": [
{
"term": {
"status": {
"value": "0"
}
}
},
{
"term": {
"creator": {
"value": "143"
}
}
}
]
}
}
]
}
},
"_source": ["book_id", "hot_index", "search"],
"sort": [
{
"_score": {
"order": "desc"
},
"hot_index" : {
"order": "desc"
}
}
]
}

输出结果:
  "hits": {
"total": 20304,
"max_score": null,
"hits": [
{
"_index": "kid_book_v14",
"_type": "kid_book",
"_id": "1087505",
"_score": 33.471928,
"_source": {
"search": "蛮荒记(完整版)",
"hot_index": 0,
"book_id": 1087505
},
"sort": [
33.471928,
0
]
},
{
"_index": "kid_book_v14",
"_type": "kid_book",
"_id": "887476",
"_score": 32.095734,
"_source": {
"search": "催眠(完整版)",
"hot_index": 0,
"book_id": 887476
},
"sort": [
32.095734,
0
]
},
{
"_index": "kid_book_v14",
"_type": "kid_book",
"_id": "2251437",
"_score": 30.83145,
"_source": {
"search": "变型数独解法完整版2",
"hot_index": 0,
"book_id": 2251437
},
"sort": [
30.83145,
0
]
},
{
"_index": "kid_book_v14",
"_type": "kid_book",
"_id": "2251435",
"_score": 30.83145,
"_source": {
"search": "变型数独解法完整版4",
"hot_index": 0,
"book_id": 2251435
},
"sort": [
30.83145,
0
]
},
{
"_index": "kid_book_v14",
"_type": "kid_book",
"_id": "2251438",
"_score": 30.83145,
"_source": {
"search": "变型数独解法完整版1",
"hot_index": 0,
"book_id": 2251438
},
"sort": [
30.83145,
0
]
},
{
"_index": "kid_book_v14",
"_type": "kid_book",
"_id": "2251436",
"_score": 30.83145,
"_source": {
"search": "变型数独解法完整版3",
"hot_index": 0,
"book_id": 2251436
},
"sort": [
30.83145,
0
]
},
{
"_index": "kid_book_v14",
"_type": "kid_book",
"_id": "3748825",
"_score": 30.591633,
"_source": {
"search": "牛津阅读树完整版Level 3 Oxford Reading Tree Level 3",
"hot_index": 5101,
"book_id": 3748825
},
"sort": [
30.591633,
5101
]
},
{
"_index": "kid_book_v14",
"_type": "kid_book",
"_id": "3748821",
"_score": 30.328512,
"_source": {
"search": "牛津阅读树完整版Level 1+ Oxford Reading Tree Level 1+",
"hot_index": 11608,
"book_id": 3748821
},
"sort": [
30.328512,
11608
]
},
{
"_index": "kid_book_v14",
"_type": "kid_book",
"_id": "3748823",
"_score": 30.328512,
"_source": {
"search": "牛津阅读树完整版Level 2 Oxford Reading Tree Level 2",
"hot_index": 8222,
"book_id": 3748823
},
"sort": [
30.328512,
8222
]
},
{
"_index": "kid_book_v14",
"_type": "kid_book",
"_id": "3748829",
"_score": 30.328512,
"_source": {
"search": "牛津阅读树完整版Level 4 Oxford Reading Tree Level 4",
"hot_index": 4261,
"book_id": 3748829
},
"sort": [
30.328512,
4261
]
}
]
已邀请:

byx313 - BLOG:https://www.jianshu.com/u/43fd06f9589c

赞同来自:

还有status跟creator2个字段影响呀,你没贴出来没办法确定

要回复问题请先登录注册