Change schemas and switch search traffic while accounting for concurrent writes.
- Create v2
- Copy + catch-up
- Validate → alias
Change schemas and switch search traffic while accounting for concurrent writes.
The course targets Elasticsearch 9.4.3. Exercise examples use the public products dataset; other requests illustrate separate teaching indices and may require setup or privileges unavailable in the trainer. Responses are shortened fragments; scores may vary. Check deployment and license requirements for advanced features.
Versions and aliases
products-v1 and products-v2 are physical indices; products-read is a stable read name. A write alias with is_write_index defines the write target. Aliases neither copy data nor synchronize versions. Submit removal and addition together through _aliases to switch routing atomically.
Check your understandingReindexing a live application
Create the destination mapping and settings before copying documents. Reindex alone does not capture every later change. Use a reproducible plan: snapshot plus a change log with a checkpoint, or a brief write pause for final catch-up. Compare counts, sampled documents and search scenarios before switching. Rollback must account for writes already accepted by the new version.
Check your understandingTemplates and time-based data
Component templates share settings; index templates configure future indices. Updating a template does not rewrite existing indices. Data streams and rollover mainly suit time-series ingestion. ILM manages lifecycle phases in applicable deployments; serverless has its own mechanisms. A frequently updated catalog should not automatically be modeled as a log stream.
Apply this only after validating v2 and catching up changes.
{
"actions": [
{
"remove": {
"index": "products-v1",
"alias": "products-read"
}
},
{
"add": {
"index": "products-v2",
"alias": "products-read"
}
}
]
}How to read this result
Apply this only after validating v2 and catching up changes.
Catalog reasoning example
During v1→v2 migration, a product changes and is deleted. Catch-up that handles only updates leaves a ghost in v2. The change log must include deletions and a checkpoint. Replay through an agreed point, validate and then switch aliases. If the old index stops receiving events, switching back a day later is not automatically a correct rollback because data may have diverged.
Check your understandingCheck your understanding
Answer before expanding each explanation.
1. Does an alias move data?
No, it routes to indices.
2. How do you switch an alias atomically?
Send remove and add in one _aliases request.
3. Does reindex capture all later writes?
No, a separate catch-up mechanism is required.
4. Does a template change existing indices?
No, it applies when new indices are created.
5. What does rollback require?
The previous index and a plan for writes after cutover.
Key takeaways
- No, it routes to indices.
- Send remove and add in one _aliases request.
- No, a separate catch-up mechanism is required.
- No, it applies when new indices are created.
- The previous index and a plan for writes after cutover.
Official reference
Ready to put this into practice?
Confirm reading to save your place. Reading and exercise progress are tracked separately in this browser using your guest cookie.