Skip to content

Widhian Bramantya

coding is an art form

Menu
  • About Me
Menu
elasticsearch

Blue-Green Deployment in Elasticsearch: Safe Reindexing and Zero-Downtime Upgrades

Posted on October 5, 2025October 5, 2025 by admin

Rollback Strategy

Always plan for rollback before you start.

ProblemRollback Option
Mapping error or missing dataSwitch alias back to old index
Performance issuesKeep old cluster active for a few hours
Incomplete reindexRestart _reindex from checkpoint
Failed upgradeRestore snapshot into old version
Something wrong in CCRyou can re-enable following or reverse replication.

Keeping both environments (blue + green) online until validation ensures you can recover quickly.

Monitoring During Migration

Use _cat APIs or Kibana to monitor progress:

GET _cat/indices?v
GET _cat/nodes?v
GET _cat/recovery?v

Watch for:

  • Shards not assigned or still initializing
  • Disk space usage during reindex
  • Cluster health (must stay green)

You can also throttle reindex speed:

POST _reindex
{
  "source": { "index": "my_index_v1" },
  "dest": { "index": "my_index_v2" },
  "max_docs": 100000,
  "script": { "source": "ctx._source.migrated = true" }
}

Common Mistakes to Avoid

MistakeProblemBetter Approach
Reindexing without aliasHard to switch safelyAlways use aliases
Mixing versions in one clusterMay corrupt stateUse separate clusters
Deleting old index too soonNo rollback possibleWait several days
Not testing queriesWrong results after switchTest both versions
Not taking snapshotsIrreversible lossAlways snapshot before upgrade

Conclusion

Blue-green deployment is the safest way to reindex or upgrade Elasticsearch without downtime.
It lets you prepare, test, and switch gradually, keeping your production system online all the time.

“Build green, test green, switch fast, sleep well.”

Follow this process:

  1. Create a new index or cluster (green)
  2. Reindex and test
  3. Switch aliases or endpoints
  4. Keep blue for rollback
  5. Clean up when everything is stable

Your users won’t notice a thing, but your Elasticsearch will be faster, cleaner, and ready for the future.

See also  Elasticsearch Best Practices for Beginners

Pages: 1 2 3
Category: ElasticSearch

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Linkedin

Widhian Bramantya

Recent Posts

  • Log Management at Scale: Integrating Elasticsearch with Beats, Logstash, and Kibana
  • Index Lifecycle Management (ILM) in Elasticsearch: Automatic Data Control Made Simple
  • Blue-Green Deployment in Elasticsearch: Safe Reindexing and Zero-Downtime Upgrades
  • Maintaining Super Large Datasets in Elasticsearch
  • Elasticsearch Best Practices for Beginners
  • Implementing the Outbox Pattern with Debezium
  • Production-Grade Debezium Connector with Kafka (Postgres Outbox Example – E-Commerce Orders)
  • Connecting Debezium with Kafka for Real-Time Streaming
  • Debezium Architecture – How It Works and Core Components
  • What is Debezium? – An Introduction to Change Data Capture
  • Offset Management and Consumer Groups in Kafka
  • Partitions, Replication, and Fault Tolerance in Kafka
  • Delivery Semantics in Kafka: At Most Once, At Least Once, Exactly Once
  • Producers and Consumers: How Data Flows in Kafka
  • Kafka Architecture Explained: Brokers, Topics, Partitions, and Offsets
  • Getting Started with Apache Kafka: Core Concepts and Use Cases
  • Security Best Practices for RabbitMQ in Production
  • Understanding RabbitMQ Virtual Hosts (vhosts) and Their Uses
  • RabbitMQ Performance Tuning: Optimizing Throughput and Latency
  • High Availability in RabbitMQ: Clustering and Mirrored Queues Explained

Recent Comments

  1. Playing with VPC AWS (Part 2) – Widhian's Blog on Playing with VPC AWS (Part 1): VPC, Subnet, Internet Gateway, Route Table, NAT, and Security Group
  2. Basic Concept of ElasticSearch (Part 3): Translog, Flush, and Refresh – Widhian's Blog on Basic Concept of ElasticSearch (Part 1): Introduction
  3. Basic Concept of ElasticSearch (Part 2): Architectural Perspective – Widhian's Blog on Basic Concept of ElasticSearch (Part 3): Translog, Flush, and Refresh
  4. Basic Concept of ElasticSearch (Part 3): Translog, Flush, and Refresh – Widhian's Blog on Basic Concept of ElasticSearch (Part 2): Architectural Perspective
  5. Basic Concept of ElasticSearch (Part 1): Introduction – Widhian's Blog on Basic Concept of ElasticSearch (Part 2): Architectural Perspective

Archives

  • October 2025
  • September 2025
  • August 2025
  • November 2021
  • October 2021
  • August 2021
  • July 2021
  • June 2021
  • March 2021
  • January 2021

Categories

  • Debezium
  • Devops
  • ElasticSearch
  • Golang
  • Kafka
  • Lua
  • NATS
  • Programming
  • RabbitMQ
  • Redis
  • VPC
© 2025 Widhian Bramantya | Powered by Minimalist Blog WordPress Theme