// This file is autogenerated, DO NOT EDIT
// ilm/error-handling.asciidoc:122

[source, python]
----
resp = client.ilm.put_lifecycle(
    name="shrink-index",
    policy={
        "phases": {
            "warm": {
                "min_age": "5d",
                "actions": {
                    "shrink": {
                        "number_of_shards": 1
                    }
                }
            }
        }
    },
)
print(resp)
----
