Impossible to implement real custom boost query when the weight is in the child document?

I found a workaround using rescore. It's not ideal, but with a large enough window, it should yield good results. Here's your query again, rewritten with a rescore.

GET index/document/_search
{
"query": {
"match": {
"title": "basketball"
}
},
"rescore": {
"window_size": 100,
"query": {
"score_mode": "multiply",
"rescore_query": {
"has_child": {
"type": "document_boost",
"query": {
"function_score": {
"script_score": {
"script": "doc['document_boost.popular_boost_recent'].value"
}
}
}
}
}
}
}
}