Unfortunately Canvas doesn't support scripted fields yet. Please show your support for that issue here: https://github.com/elastic/kibana/issues/26846
We do use community feedback to inform our roadmap so it would help with prioritization.
For now, I think this leaves you in the position of needing to transform your data before it's ingested into Kibana.