Index retention patterns
Learn to set index retention patterns and manage maximum indices in your Aiven for OpenSearch® instance.
Set index retention patterns
To define index retention policies for your OpenSearch indices:
- Console
- API
- Log in to the Aiven Console, select your project, and select your Aiven for OpenSearch service.
- Click Indexes on the sidebar. The Indexes section lists the patterns that are currently in use.
- Click Add pattern.
- Enter the pattern to use and the maximum index count for the pattern.
- Click Create.
Alternatively, you can use the API with a request similar to the following:
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 <YOUR TOKEN HERE>" \
https://api.aiven.io/v1beta/project/<project>/service/<service_name>
Parameters:
<project>
: Your Aiven project name.<service_name>
: Name of your Aiven for OpenSearch service.