Skip to content

Support Index Aliasing (for Blue/Green datasets, CQRS) #590

Open
@elicore

Description

@elicore

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

  1. Create index idx-<date> with prefix idx:<date>:
  2. Create an alias idx
  3. Add documents with idx:<date>: prefix

Clients can then use the idx index to run search commands on the dataset.

Green Dataset

  1. Create index idx-<date+1> with prefix idx:<date+1>:
  2. Add documents with idx:<date+1>
  3. Track the indexing progress
  4. Once all documents are indexed, change the idx alias to point to idx-<date+1>
  5. (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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions