elasticsearch icon indicating copy to clipboard operation
elasticsearch copied to clipboard

Allow writing to multiple indices via alias

Open hauntingEcho opened this issue 4 years ago • 7 comments

When making a mapping change which cannot be made in-place, the current standard practice seems to be:

  1. create a new index with the desired mapping
  2. multiplex writes to both indices
  3. use the reindex API to copy old data
  4. only write to the new index
  5. delete the old index

Currently, steps 2 & 4 in that process must be done by updating all writers to the index, as "It is an error to index to an alias which points to more than one index." per the docs. Being able to use aliases to manage steps 2 & 4 in this process will make migrations much simpler.

Being able to atomically reindex & update the target of an alias (steps 2-4 above), all as a single step, would also solve this issue but might not be ideal for very large data loads.

This has also been discussed in #6240 but this use case was only really highlighted five years after the issue was closed.

hauntingEcho avatar Jan 26 '21 15:01 hauntingEcho

Pinging @elastic/es-core-features (Team:Core/Features)

elasticmachine avatar Jan 26 '21 18:01 elasticmachine

also relates to #56186

hauntingEcho avatar Feb 25 '21 16:02 hauntingEcho

Any update on this? We really want this feature too.

taichi-jp avatar Aug 12 '21 00:08 taichi-jp

+1 for this feature, it'll be good for reindexing when you have an option to do writes simultaneously to two indices so that the new index will always be in sync with the live index.

nisar6062 avatar Dec 09 '21 13:12 nisar6062

The primary usecase of the Reindex API is to allow zero downtime index migrations for mapping changes requiring reindexing.

But the Reindex API and aliases alone do not enable zero-downtime index migrations without potential data loss. To do this correctly requires custom Indexer work so that an Indexer is aware of the reindex and may write to both old and new indices while reindexing is happening.

This could happen here. I realize that forcing aliases to have a single write index is convenient for ILM and Rollover, but could there not be a way to override this for reindexing?

peterdm avatar Aug 11 '22 02:08 peterdm

+1. This is an issue whenever doing zero downtime reindexing of mutable data that may be updated while the new index is being generated.

ellerycrane avatar Dec 01 '22 18:12 ellerycrane

+1 would be great if this feature would be pickedup

TS-Eichhorn avatar May 06 '24 13:05 TS-Eichhorn

+1, It will be great if the feature is provided.

dhinesh-valarman avatar Jul 10 '24 08:07 dhinesh-valarman