Documentation: Could the example for scripted metric aggregations be rewritten to work with Painless?

Hi,
According to the documentation, I should use groovy for scripted metric agg:
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-scripted-metric-aggregation.html

However, as we know, groovy has been deprecated and painless should be used.
Could you please rewrite the documentation on how to use painless with this same example?

Regards,
Bjorn

Absolutely. I'll add it near the top of my deque. I've been slowly porting all of the docs over to CONSOLE syntax so they get the SHOW IN CONSOLE and COPY AS CURL links and are automatically tested as part of the build.

Hi,
I see the documentation has been updated.
Thank you Nik, great work!
Regards,
Bjorn

Sorry this took so long!