Kibana Visualization error >> Esaags error - Bad Request

I tried to reproduce it both with numerical and string scripted fields on versions 7.16.3 and 7.10.0 and couldn't reproduce. Is there anything special about your scripted field? (type, formatting)

Could you upgrade to at least 7.10?
string scripted field 7.16


numerical scripted field 7.10: