Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
colings86 opened this issue Mar 16, 2015 · 2 comments
Closed

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

colings86 opened this issue Mar 16, 2015 · 2 comments
Assignees
Labels
:Data Management/Indices APIs APIs to create and manage indices and templates >docs General docs changes >enhancement

Comments

@colings86
Copy link
Contributor

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?

@colings86 colings86 added >docs General docs changes :Aliases labels Mar 16, 2015
@javanna
Copy link
Member

javanna commented Mar 17, 2015

yeah tricky bits @colings86 , least we can do is documenting this. I wonder if we should just prevent users from creating aliases against aliases till we properly support it as this seems like a trap.

@javanna
Copy link
Member

javanna commented Jun 6, 2017

With #23977, in master we expand index expressions against indices only when managing aliases. I find that this is even better than updating our docs on the caveats of aliasing aliases, as that is not no longer allowed. Closing.

@javanna javanna closed this as completed Jun 6, 2017
@clintongormley clintongormley added :Data Management/Indices APIs APIs to create and manage indices and templates and removed :Aliases labels Feb 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Data Management/Indices APIs APIs to create and manage indices and templates >docs General docs changes >enhancement
Projects
None yet
Development

No branches or pull requests

5 participants