// This file is autogenerated, DO NOT EDIT
// aggregations/metrics/weighted-avg-aggregation.asciidoc:214

[source, python]
----
resp = client.search(
    index="exams",
    size=0,
    aggs={
        "weighted_grade": {
            "weighted_avg": {
                "value": {
                    "field": "grade",
                    "missing": 2
                },
                "weight": {
                    "field": "weight",
                    "missing": 3
                }
            }
        }
    },
)
print(resp)
----
