// This file is autogenerated, DO NOT EDIT
// docs/update-by-query.asciidoc:591

[source, python]
----
resp = client.update_by_query(
    index="my-index-000001",
    slice={
        "id": 0,
        "max": 2
    },
    script={
        "source": "ctx._source['extra'] = 'test'"
    },
)
print(resp)

resp1 = client.update_by_query(
    index="my-index-000001",
    slice={
        "id": 1,
        "max": 2
    },
    script={
        "source": "ctx._source['extra'] = 'test'"
    },
)
print(resp1)
----
