-
Notifications
You must be signed in to change notification settings - Fork 101
Description
Index aliasing is commonly used in blue/green datasets, where data is refreshed periodically and clients always read from the latest complete dataset.
Blue/Green Strategy
This strategy generally follows these steps
Blue (Initial) Dataset
- Create index
idx-<date>with prefixidx:<date>: - Create an alias
idx - Add documents with
idx:<date>:prefix
Clients can then use the idx index to run search commands on the dataset.
Green Dataset
- Create index
idx-<date+1>with prefixidx:<date+1>: - Add documents with
idx:<date+1> - Track the indexing progress
- Once all documents are indexed, change the
idxalias to point toidx-<date+1> - (Optionally) Delete the
idx-<date>index
Clients are reading from the blue dataset before changing the index alias, and from the green dataset immediately after changing the alias. The green dataset is now the new blue dataset.
Currently the Document definition requires the key prefix, which is a dynamic value when using index aliases, depending on the date (in the example above).
Adding aliasing support will allow clients to use this library with CQRS, having separate logic for loading documents and searching documents, where the read implementation does not need to be aware of the underlying data refresh strategy.
Additionally, it would be nice to have support for writing documents using the same Repository logic, but specifying a different index name (for populating a green dataset in our example).
See also: