Set index retention patterns ============================ This article describes how to configure the maximum number of indices to keep in your Aiven for OpenSearch® instance. For more information on OpenSearch® indices and shards, see :doc:`this article `. To create cleanup patterns for OpenSearch indices: #. Log in to the `Aiven web console `_ and select your service. #. Select **Indexes** from the left sidebar. The **Indexes** section lists the patterns that are currently in use. #. Select **Add pattern**. #. Enter the pattern that you want to use and the maximum index count for the pattern, then select **Create**. Alternatively, you can use our `API `_ with a request similar to the following: .. code:: curl -X PUT --data '{"user_config":{"index_patterns": [{"pattern": "logs*", "max_index_count": 2},{"pattern":"test.?", "max_index_count": 3}]}' header "content-type: application-json" --header "authorization: aivenv1 " https://api.aiven.io/v1beta/project//service/