Scripted_metric in Kibana visualization

Could you provide the script you're using so we can see if there is a good way to accomplish it in Kibana?