Skip to content

[DOCS] Warn about the caveats with aliasing aliases #10106

@colings86

Description

@colings86

Aliases are just tags on indices and not constructs in their own right. At the moment you can create an alias using aliases by doing the following:

curl -XPOST 'localhost:9200/_aliases' -d '{
    "actions" : [
        { "add" : { "index" : "2015-01-07", "alias" : "today" } }
        { "add" : { "index" : "2015-01-06", "alias" : "yesterday" } }
        { "add" : { "index" : "2015-01-05", "alias" : "3DaysAgo" } }
        { "add" : { "index" : "2015-01-04", "alias" : "4DaysAgo" } }
        { "add" : { "index" : "2015-01-03", "alias" : "5DaysAgo" } }
        { "add" : { "index" : "2015-01-02", "alias" : "6DaysAgo" } }
        { "add" : { "index" : "2015-01-01", "alias" : "7DaysAgo" } }
    ]
}'

curl -XPOST 'localhost:9200/_aliases' -d '{
    "actions" : [
        { "add" : { "index" : "today", "alias" : "thisWeek" } }
        { "add" : { "index" : "yesterday", "alias" : "thisWeek" } }
        { "add" : { "index" : "3DaysAgo", "alias" : "thisWeek" } }
        { "add" : { "index" : "4DaysAgo", "alias" : "thisWeek" } }
        { "add" : { "index" : "5DaysAgo", "alias" : "thisWeek" } }
        { "add" : { "index" : "6DaysAgo", "alias" : "thisWeek" } }
        { "add" : { "index" : "7DaysAgo", "alias" : "thisWeek" } }
    ]
}'

This makes it look like thisWeek points to today which points to 2015-01-07. What actually happens is that 2015-01-07 gets two aliases: today and thisWeek. This works absolutely fine but anyone using this method needs to be aware that if they update the today alias to point to 08-01-2015 it will not update the thisWeek alias and they will need to update that alias as well.

Is this something we should add to the documentation?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions