Function_score limit size


(YG) #1

Hello

If I am writing such a ES script to do search

{
"query": {
"function_score" : {
"boost_mode": "replace",
"query": {
"match": {
XXXXXX
}
},
"script_score": {
"script": "XXXXXXX",
"lang": "native",
"params": {
XXXXXX
}
}
}
},
"size": 10
}

the idea is we will use a native script to rescore the search results returned from the first query. I am wondering is there a way we can limit the size for second stage native script rescoing since rescoring is very expensive. In rescore function, there was a "window_size" parameter, but it seems there is no such parameter for function_score. Please advise some feasible approach?

Thanks!


(system) #2