I am running rescore_query with ltr model with window_size=5,
I am seeing the recore_query is being applied to top 5 docs in hits and top 5 docs of every aggregated bucket.
Is the how rescore_query designed to work?
following is the trimmed down query.
{
"sort": [
{
"_score": "desc"
}
],
"size": 30,
"aggs": {
"section_wise_results": {
"terms": {
"field": "home_search_section_id",
"size": 6,
"order": {
"score_": "desc"
}
},
"aggs": {
"section_bucket": {
"top_hits": {
"size": 20
}
},
"score_": {
"max": {
"script": {
"inline": "_score"
}
}
}
}
}
},
"query": {
"function_score": {
"query": {
"bool": {
"must": {
"multi_match": {
"query": "pay",
"fields": [
"tags",
"display_text",
"display_subtext"
],
"type": "best_fields",
"operator": "and",
"fuzziness": "AUTO:100,102",
"prefix_length": 2
}
}
}
},
"script_score": {
"script": {
"source": "(_score * params.relevance_weight * params.new_max / params.old_max) + (doc['ctr_score'].size()>0 ? doc['ctr_score'].value * params.ctr_weight : 0) + (doc['freshness_score'].size()>0 ? doc['freshness_score'].value * params.freshness_weight : 0)",
"params": {
"relevance_weight": 0.85,
"new_max": 100,
"old_max": 100,
"ctr_weight": 0.15,
"freshness_weight": 0.15
}
}
},
"boost_mode": "replace"
}
},
"rescore": {
"window_size":5,
"query": {
"rescore_query": {
"function_score": {
"boost_mode": "replace",
"query": {
"sltr": {
"params": {
"keywords": "pay"
},
"model": "xgboost_model_v1"
}
},
"script_score": {
"script": {
"source": "100.0 + _score"
}
}
}
},
"query_weight": 0.001,
"rescore_query_weight": 1
}
}
}