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

[source, python]
----
resp = client.search(
    index="sales",
    size=0,
    runtime_mappings={
        "price.adjusted": {
            "type": "double",
            "script": "\n        double price = doc['price'].value;\n        if (doc['promoted'].value) {\n          price *= 0.8;\n        }\n        emit(price);\n      "
        }
    },
    aggs={
        "min_price": {
            "min": {
                "field": "price.adjusted"
            }
        }
    },
)
print(resp)
----
