What is the Reindex API and when would you use it?
Answer
The Reindex API (POST /_reindex) copies documents from a source index to a destination index. The primary use case is zero-downtime index migrations: when you need to change a field mapping (e.g., change a text field to keyword), you create a new index with the correct mapping, reindex data from the old index to the new one while the old index continues serving traffic, then atomically switch an alias from old to new. Reindex also supports a query to copy only matching documents, a script to transform documents during copying, and cross-cluster reindexing. It can be slow for large indexes — use slices for parallel execution.
Previous
What are index templates and component templates in Elasticsearch?
Next
What is an index alias in Elasticsearch?
More Elasticsearch Questions
View all →- Intermediate What is the difference between query context and filter context in Elasticsearch?
- Intermediate What is a bool query in Elasticsearch?
- Intermediate What are aggregations in Elasticsearch?
- Intermediate What is the difference between text and keyword field types?
- Intermediate What are index templates and component templates in Elasticsearch?