tencent cloud

Elasticsearch Service

Hybrid Search (RRF Fusion Ranking)

Download
Modo Foco
Tamanho da Fonte
Última atualização: 2026-08-12 18:13:52
Traduzido por IA
During hybrid search, the scoring mechanisms of text search and vector search differ significantly. The basic idea of Reciprocal Rank Fusion (RRF) is to assign a weight to the ranking result of each system, where the weight is the reciprocal of its rank. Specifically, for each item in the ranked list of each system, the RRF algorithm calculates a score, which is the sum of the reciprocals of that item's rank across all lists. Then, all items are reranked based on this score to generate the final fused ranking list. RRF is built into ES, requiring no external model services. As a lightweight algorithm, it can be used as one of the fusion ranking algorithms for the coarse ranking phase.

Syntax 1: Retriever Method (Officially Available Since Elastic Has Introduced Version 8.16)

For details about the retriever method, see Retrievers.
Note:
Tencent Cloud Elasticsearch Service (ES) has independently developed support for the RRF algorithm since version 8.16. In terms of syntax, it replaces the following rrf with rank_fusion. Elastic has introduced RRF since version 9.
GET /book-index/_search
{
"retriever": {
"rrf": { // For Tencent Cloud ES 8.16, use rank_fusion here; for later versions, use rrf.
"retrievers": [
{
"retriever": {
"knn": {
"field": "title_vector",
"query_vector": [0.1, 0.2, 0.3 ...],
"k": 10,
"num_candidates": 100
}
},
"weight": 0.8
},
{
"retriever": {
"standard": {
"query": {
"match": {
"title_text": "Human"
}
}
}
},
"weight": 0.2
}
],
"rank_window_size": 50,
"rank_constant": 20
}
}
}

Syntax 2: Traditional Method (Deprecated, Not Recommended)

GET /book-index/_search
{
"knn":{
"field":"content_vector",
"query_vector": [0.5, 0.6, 0.7 ...],
"k":10,
"num_candidates": 100
},
"query":{
"match":{
"title_text":{
"query": "Human"
}
}
},
"rank":{
"rrf":{
"rank_window_size":50,
"rank_constant":20
}
},
"size": 10
}

Parameter description:
rank_window_size: number of results taken from each query to participate in fusion. The default value is 100.
rank_constant: constant that controls ranking. A smaller value has a greater impact on the ranking. The default value is 60.
The calculation formula for RRF is as follows:


Ajuda e Suporte

Esta página foi útil?

comentários