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  Advanced Text Search in Elasticsearch: N-Gram, Reverse, Fuzzy, and Search-as-you-type

Related posts:

Basic Concept of ElasticSearch (Part 1): Introduction

Basic Concept of ElasticSearch (Part 2): Architectural Perspective

Understanding and Customizing Analyzers in Elasticsearch

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

  • Smart Automation in PostgreSQL: Managing Time-Based Data with pg_partman and pg_cron
  • Understanding PostgreSQL WAL, Slot, Publication, LSN, and Replication Lag
  • PostgreSQL Write-Ahead Log (WAL): Durability, Performance Tuning, and Recovery Explained
  • PostgreSQL Replication Deep Dive: From High Availability to Multi-Master Clusters
  • Finding Nearby Merchants in a Ride-Hailing App Using Elasticsearch Polygon Search
  • Advanced Text Search in Elasticsearch: N-Gram, Reverse, Fuzzy, and Search-as-you-type
  • Understanding and Customizing Analyzers in Elasticsearch
  • 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

Recent Comments

No comments to show.

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
  • PostgreSQL
  • Programming
  • RabbitMQ
  • Redis
  • VPC
© 2026 Widhian Bramantya | Powered by Minimalist Blog WordPress Theme