How can I use arcDistance in 6.7 painless

How can I use arcDistance in 6.7 painless?

doc['location'].arcDistanceInKm(37.495359, 127.033065)

"type": "illegal_argument_exception",
            "reason": "dynamic method [org.elasticsearch.index.fielddata.ScriptDocValues.GeoPoints, arcDistanceInKm/2] not found"

The method available is arcDistance (https://www.elastic.co/guide/en/elasticsearch/painless/6.7/painless-api-reference.html) found in the API docs here. arcDistance is in meters so the result will need to be multiplied by 1000.