-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Closed
Labels
:Data Management/Indices APIsAPIs to create and manage indices and templatesAPIs to create and manage indices and templates>docsGeneral docs changesGeneral docs changes>enhancement
Description
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
Labels
:Data Management/Indices APIsAPIs to create and manage indices and templatesAPIs to create and manage indices and templates>docsGeneral docs changesGeneral docs changes>enhancement