// This file is autogenerated, DO NOT EDIT
// aggregations/metrics/percentile-aggregation.asciidoc:185

[source, python]
----
resp = client.search(
    index="latency",
    size=0,
    runtime_mappings={
        "load_time.seconds": {
            "type": "long",
            "script": {
                "source": "emit(doc['load_time'].value / params.timeUnit)",
                "params": {
                    "timeUnit": 1000
                }
            }
        }
    },
    aggs={
        "load_time_outlier": {
            "percentiles": {
                "field": "load_time.seconds"
            }
        }
    },
)
print(resp)
----
