Mafiree logo
  • About
  • Services
  • Blogs
  • Careers
  • Products
    • orbit logo Orbit
    • streamer logo Xstreami
  • Contact
Schedule a Call
Menu
  • About
  • Services
  • Blogs
  • Careers
  • Products
    • orbit logo Orbit
    • streamer logo Xstreami
  • Contact
  • Schedule a Call
Database
Database Database Managed Services
MySQL MySQL
MySQL Consulting Services
MySQL Migration Services
MySQL Optimization & Query Tuning
MySQL Database Administration
MySQL Backup & Recovery
MySQL Security & Maintenance
MySQL Cloud Services (AWS RDS, Aurora, Google Cloud SQL, Azure)
MySQL for Ecommerce
MySQL High Availability & Replication
MongoDB MongoDB
MongoDB Consulting Services
MongoDB Migration Services
MongoDB Optimization & Query Tuning
MongoDB Database Administration
MongoDB Backup & Recovery
MongoDB Security & Maintenance
MongoDB Cloud (Atlas)
MongoDB Solutions by Industry
MongoDB High Availability & Replication
PostgreSQL PostgreSQL
PostgreSQL Consulting
PostgreSQL Migration & Upgrades
Performance Tuning & Query Optimization
PostgreSQL Administration & Managed Services
High Availability, Clustering & Replication
PostgreSQL Backup, Recovery & Disaster Planning
PostgreSQL Security, Compliance & Auditing
PostgreSQL for Analytics & Data Warehousing
PostgreSQL on Cloud & Containers
PostgreSQL Extensions & Open-Source Integrations
PostgreSQL for Every Industry
SQL Server MSSQL
MSSQL Consulting Services
MSSQL Migration Services
MSSQL Optimization & Query Tuning Services
MSSQL Database Administration Services
MSSQL Backup & Recovery Services
MSSQL High Availability & Replication Services
MSSQL Security & Compliance Services
MSSQL Performance Monitoring & Health Checks
MSSQL Solutions by Industry
Aerospike Aerospike
Aerospike Consulting Services
Aerospike Migration Services
Aerospike Performance Optimization & Tuning
Aerospike Database Administration
Aerospike Backup & Recovery
Aerospike High Availability
Aerospike Cloud & Hybrid Deployments
Aerospike for Real-Time Applications (AdTech, FinTech, Retail, IoT)
Analytics DB
Analytics DB Analytics DB Services
Clickhouse Clickhouse
ClickHouse Consulting Services
ClickHouse Migration Services
ClickHouse Optimization & Query Tuning
ClickHouse Database Administration
ClickHouse Backup & Recovery
ClickHouse Security & Maintenance
ClickHouse Cloud Services (ClickHouse Cloud, AWS, GCP, Azure)
ClickHouse Solutions by Industry
ClickHouse High Availability & Replication
TiDB TiDB
TiDB Consulting & Architecture Planning
TiDB Administration & Maintenance
TiDB Security and Privacy Maintenance
TiDB Performance & Query Optimization
TiDB Migration Services
TiDB Backup & Disaster Recovery
TiDB High Availability Solutions
TiDB Solutions by Industry
TiDB Cloud Services
ScyllaDB ScyllaDB
ScyllaDB Consulting & Architecture Planning
ScyllaDB Administration & Maintenance
ScyllaDB Security and Privacy Maintenance
ScyllaDB Performance & Query Optimization
ScyllaDB Migration Services
ScyllaDB Backup & Disaster Recovery
ScyllaDB High Availability Solutions
ScyllaDB Solutions by Industry
ScyllaDB Cloud Services
DevOps
DevOps DevOps Services
Version Control Version Control
Kubernetes Kubernetes
Infrastructure Infrastructure Management
Web Servers Web Servers
Networking
Networking Networking Services
Basic Basic
Advanced Advanced
MySQL MySQL
MongoDB MongoDB
PostgreSQL PostgreSQL
MSSQL MSSQL
Aerospike Aerospike
Clickhouse Clickhouse
TiDB TiDB
ScyllaDB ScyllaDB
Version Control Version Control
Kubernetes Kubernetes
Infrastructure Infrastructure Management
Web Servers Web Servers
Basic Basic
Advanced Advanced
MySQL Consulting Services
MySQL Migration Services
MySQL Optimization & Query Tuning
MySQL Database Administration
MySQL Backup & Recovery
MySQL Security & Maintenance
MySQL Cloud Services (AWS RDS, Aurora, Google Cloud SQL, Azure)
MySQL for Ecommerce
MySQL High Availability & Replication
MongoDB Consulting Services
MongoDB Migration Services
MongoDB Optimization & Query Tuning
MongoDB Database Administration
MongoDB Backup & Recovery
MongoDB Security & Maintenance
MongoDB Cloud (Atlas)
MongoDB Solutions by Industry
MongoDB High Availability & Replication
PostgreSQL Consulting
PostgreSQL Migration & Upgrades
Performance Tuning & Query Optimization
PostgreSQL Administration & Managed Services
High Availability, Clustering & Replication
PostgreSQL Backup, Recovery & Disaster Planning
PostgreSQL Security, Compliance & Auditing
PostgreSQL for Analytics & Data Warehousing
PostgreSQL on Cloud & Containers
PostgreSQL Extensions & Open-Source Integrations
PostgreSQL for Every Industry
MSSQL Consulting Services
MSSQL Migration Services
MSSQL Optimization & Query Tuning Services
MSSQL Database Administration Services
MSSQL Backup & Recovery Services
MSSQL High Availability & Replication Services
MSSQL Security & Compliance Services
MSSQL Performance Monitoring & Health Checks
MSSQL Solutions by Industry
Aerospike Consulting Services
Aerospike Migration Services
Aerospike Performance Optimization & Tuning
Aerospike Database Administration
Aerospike Backup & Recovery
Aerospike High Availability
Aerospike Cloud & Hybrid Deployments
Aerospike for Real-Time Applications (AdTech, FinTech, Retail, IoT)
ClickHouse Consulting Services
ClickHouse Migration Services
ClickHouse Optimization & Query Tuning
ClickHouse Database Administration
ClickHouse Backup & Recovery
ClickHouse Security & Maintenance
ClickHouse Cloud Services (ClickHouse Cloud, AWS, GCP, Azure)
ClickHouse Solutions by Industry
ClickHouse High Availability & Replication
TiDB Consulting & Architecture Planning
TiDB Administration & Maintenance
TiDB Security and Privacy Maintenance
TiDB Performance & Query Optimization
TiDB Migration Services
TiDB Backup & Disaster Recovery
TiDB High Availability Solutions
TiDB Solutions by Industry
TiDB Cloud Services
ScyllaDB Consulting & Architecture Planning
ScyllaDB Administration & Maintenance
ScyllaDB Security and Privacy Maintenance
ScyllaDB Performance & Query Optimization
ScyllaDB Migration Services
ScyllaDB Backup & Disaster Recovery
ScyllaDB High Availability Solutions
ScyllaDB Solutions by Industry
ScyllaDB Cloud Services
  1. Home
  2. > Blogs
  3. > OpenSearch
  4. > How to rollover indexes automatically using ISM policies in AWS OpenSearch

How to rollover indexes automatically using ISM policies in AWS OpenSearch

Learn how to automate index rollover in AWS OpenSearch using ISM (Index State Management) policies to manage your log data efficiently and ensure optimal search performance.

Kreshanth S March 24, 2026

Subscribe for email updates

Introduction

OpenSearch is an open-source search and analytics suite, while Amazon OpenSearch Service is a managed service on Amazon Web Services that allows organizations to host and manage OpenSearch clusters in the cloud.

In this blog, we will discuss OpenSearch index automatic rollover using ISM policies, an issue faced by one of our clients, and how we successfully solved it.

 

Mafiree Field Story: Fixing 100 GB/day Rollover

One of our clients had an architecture where logs were pushed continuously from multiple servers and environments into an OpenSearch cluster using Fluent Bit.

Architecture Overview

Servers (multiple environments)
→ Fluent Bit log forwarder
→ AWS OpenSearch cluster

Client's AWS Opensearch Architecture

The first thing we noticed was that their indexes were growing at a rate of more than 100 GB per day. Logs were ingested from multiple development environments continuously, which made automatic index rollover mandatory for cluster stability.

The client attempted to implement an OpenSearch ISM rollover policy to automatically roll over indexes when the primary shard size reached a certain threshold. However, the rollover kept failing every time it triggered.

 

Why Index Rollover Matters (Cost, Scale, Stability)

Implementing OpenSearch automatic rollover is critical in log-heavy architectures.

Benefits include:

 

  • Improved cluster stability
     
  • Optimized shard sizes
     
  • Reduced memory usage
     
  • Faster search and indexing performance
     
  • Lower storage and infrastructure cost

     

According to official OpenSearch recommendations, the optimal primary shard size should be between 30 GB and 50 GB.

Why?

Shard SizeImpact
Too SmallToo many shards → cluster overhead
Optimal (30–50GB)Balanced performance
Too LargeMemory pressure and slow recovery

Large shards require more memory and can lead to out-of-memory errors. Copy and recovery operations also become slower with oversized shards.

Maintaining optimal shard sizes significantly improves cluster performance.

 

ISM Fundamentals (Job Interval, Red Cluster Blocking)

ISM (Index State Management) policies control the lifecycle of an index.

An ISM policy in OpenSearch consists of:

 

  • States
  • Actions
  • Transitions

Job Interval

The policy execution interval determines how frequently OpenSearch evaluates rollover conditions.

 

Red Cluster Blocking

If the cluster health becomes red, certain lifecycle operations like rollover can fail or be delayed.

 

Index Naming & Alias Patterns (Critical Gotchas)

One of the most common reasons OpenSearch index rollover fails is incorrect index naming.

 

For automatic rollover to work, the index name must follow this pattern:

^.*-\d+$

 

Example valid index names:

 

  • mafiree-index-01
  • mafiree-index-00001
  • mafiree-001

This naming pattern allows OpenSearch to automatically generate the next sequential index name during rollover.

 

CTA

 

Setting Up Automatic Rollover (Step-by-Step)

Below is a simple OpenSearch index automatic rollover example using ISM policies.

 

Step 1 — Create an Index Template

An index template defines the general configuration applied to indexes that match a certain pattern.

Example:

PUT _index_template/mafiree-index-template
{
 "index_patterns": [
   "mafiree*"
 ],
 "template": {
   "settings": {
     "index.number_of_shards": "3",
     "index.number_of_replicas": "2"
   }
 },
 "composed_of": [],
 "priority": "100",
 "_meta": {
   "flow": "simple"
 }
}

This template applies the configuration to all indexes that match mafiree*.

 

Step 2 — Create an OpenSearch ISM Policy

An ISM policy defines lifecycle actions for indexes.

Example policy:

PUT _plugins/_ism/policies/mafiree-rollover-policy
{
 "policy": {
   "description": "ISM policy to keep the size of each primary shard optimal",
   "default_state": "rollover",
   "states": [
     {
       "name": "rollover",
       "actions": [
         {
           "rollover": {
             "min_primary_shard_size": "30gb"
           }
         }
       ],
       "transitions": []
     }
   ],
   "ism_template": {
     "index_patterns": ["mafiree*"],
     "priority": 100
   }
 }
}

This OpenSearch ISM rollover policy triggers rollover once the primary shard size reaches 30 GB.

 

Step 3 — Create the Index

You can create indexes via:

 

  • OpenSearch Dashboard (GUI)
  • Bulk API
  • Log ingestion tools like Fluent Bit
  • Ensure the index naming pattern is valid for rollover.

Step 4 — Create the Rollover Alias

In OpenSearch, an alias acts as a pointer to an index.

A rollover alias allows applications to write data without changing the index name after rollover.

 

Example:

POST /mafiree*/_alias/mafiree-rollover-alias

This alias routes requests to indexes matching mafiree*.

 

Step 5 — Add Rollover Alias to Index Template

Now we connect everything together.

 

PUT _index_template/mafiree-index-template
{
 "index_patterns": [
   "mafiree*"
 ],
 "template": {
   "settings": {
     "index.number_of_shards": "3",
     "index.number_of_replicas": "2",
     "index.plugins.index_state_management.rollover_alias": "mafiree-rollover-alias"
   }
 },
 "composed_of": [],
 "priority": "100",
 "_meta": {
   "flow": "simple"
 }
}

This setting ensures all indexes created through the template automatically use the rollover alias.

 

AWS OpenSearch Console Workflow

If you are using AWS OpenSearch, you can monitor rollover status from the dashboard.

 

Rollover status check in Opensearch dashboard

Navigate to:

 

  • Index Management → Indexes → Policy Managed Indexes
  • Here you can view:
  • ISM job status
  • Policy execution state
  • Rollover action progress

Troubleshooting: Why Your Rollover Isn't Working

Many users struggle with OpenSearch automatic rollover not triggering.

 

Common causes include:

 

1. Missing rollover alias

Error:

Missing rollover_alias index setting

Fix: Add

index.plugins.index_state_management.rollover_alias

to the index template.

 

2. Incorrect index naming pattern

If your index does not match:

^.*-\d+$

automatic rollover will fail.

 

3. Alias not set as write index

The alias must point to the current write index.

 

4. ISM policy not attached

Ensure the ISM policy is applied to the index pattern.

 

5. Rollover condition not met

Check if the shard size has actually crossed:

min_primary_shard_size

 

6. Cluster health issues

If cluster health is red, rollover actions may not execute.

 

Hot-Warm-Delete Lifecycle

A typical ISM lifecycle policy may include multiple phases:

PhasePurpose
HotActive indexing
WarmReduced resources
DeleteRemove old indexes

This lifecycle helps reduce storage cost while maintaining performance.

 

Production Patterns & Anti-Patterns

Best practices for OpenSearch index rollover in production:

 

Recommended

  • Keep shard sizes 30–50 GB
  • Use rollover aliases
  • Apply index templates
  • Monitor ISM job execution

Avoid

  • Creating too many shards
  • Large shard sizes (>100 GB)
  • Missing alias configurations
  • Improper index naming 

Conclusion

By recreating the configuration in a controlled test environment, we were able to identify the missing pieces and properly implement OpenSearch index automatic rollover using ISM policies. After applying the correct index templates, ISM policies, naming patterns, and rollover alias configuration, the client’s OpenSearch cluster began rolling over indexes automatically without any failures. If you are facing similar challenges with your OpenSearch cluster, feel free to reach out to us at sales@mafiree.com. Our team can help you optimize your cluster, improve performance, and ensure smooth index lifecycle management.

FAQ

Index rollover automatically creates a new index when a threshold condition is met, such as size, age, or document count.
The default refresh interval is 1 second, which controls how frequently newly indexed documents become searchable.
rollover_alias is an alias that points to the current write index, allowing OpenSearch to seamlessly create new indexes during rollover.
Both platforms share similar architecture. Performance differences depend more on cluster configuration and hardware.
There is no strict limit, but the practical limit depends on cluster resources and shard count.
Steps: Create index template Create ISM policy Ensure index naming pattern Create rollover alias Add alias to index template
Common reasons include: Missing rollover alias Incorrect index naming Policy not attached Rollover condition not met Cluster health issues
You can attach a policy using the Index Management API or from the OpenSearch dashboard under Index Management.

Leave a Comment

Subscribe for email updates

Get in touch with us

Highlights

More than 6000 Servers Monitored

Happy Clients

Certified DBAs

24 x 7 x 365 Support

PCI

Database Services

MySQL MongoDB PostgreSQL SQL Server Aerospike Clickhouse TiDB MariaDB Columnstore

Quick Links

Careers Blog Contact Privacy Policy Disclaimer Policy

Contacts

Linkedin Mafiree Facebook Mafiree Twitter Mafiree

Nagercoil Office

Miru IT Park, Vallankumaranvillai,

Nagercoil, Tamilnadu - 629 002.

Bangalore Office

Unit 303, Vanguard Rise,

5th Main, Konena Agrahara,

Old Airport Road, Bangalore - 560 017.

Call: +91 6383016411

Email: sales@mafiree.com


Copyright © - All Rights Reserved - Mafiree