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

[source, python]
----
resp = client.search(
    index="sales",
    size="0",
    query={
        "constant_score": {
            "filter": {
                "match": {
                    "type": "hat"
                }
            }
        }
    },
    aggs={
        "hat_prices": {
            "sum": {
                "field": "price",
                "missing": 100
            }
        }
    },
)
print(resp)
----
