Rewrite query without dynamic scipting

Hi

i have a old query that does a fuzzy query on a field and then does a term aggregate on that field and then a sub aggregation on max _score.

I am moving over to elastic cloud but i can't use the query becuase elastic cloud does not have fine grain control of dynamic scripting permitions.

So how do rewrite this query without needing dynamic scripting permission.

{
"size": 0,
"query": {
"match": {
"basic.province": "ga"
}
},
"aggs": {
"term_agg": {
"terms": {
"field": "basic.province.untouched",
"size": 10,
"order": {
"max_score": "desc"
}
},
"aggs": {
"max_score": {
"max": {
"script": "_score"
}
}
}
}
}
}

thanks