// This file is autogenerated, DO NOT EDIT
// search/search-your-data/sort-search-results.asciidoc:572

[source, python]
----
resp = client.search(
    sort=[
        {
            "_geo_distance": {
                "pin.location": [
                    [
                        -70,
                        40
                    ],
                    [
                        -71,
                        42
                    ]
                ],
                "order": "asc",
                "unit": "km"
            }
        }
    ],
    query={
        "term": {
            "user": "kimchy"
        }
    },
)
print(resp)
----
