I think there is a need to start supporting the a query-expresion as a json object, the same way as filters and aggregations work. The issue is how to keep backward compatibility with the existing “query” field which is a EnonicQL-expression. This is nice for some scenarios, but very soon get complex creating controllers since you have to translate stuff into strings that is very error-prone. With this is place it really a matter of mimic more or less the es-api, https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html
An alternative is to express this as a new separate field in the query-api, e.g function_score, but in the longer term I think the way to go is to rework the original query-api.
Luckily, its easy in XP to create a completely reworked query-lib