Skip to content

Aliases: Add get index alias api that allows get specific aliases #3075

Closed
@martijnvg

Description

@martijnvg

Add get index alias api that allows to filter by alias name and index name. This api redirects to the master and fetches the requested index aliases, if available. This api only serialises the found index aliases.

Possible options:

  • index - The index name to get aliases for. Partially names are supported via wildcards, also multiple index names can be specified separated with a comma. Also the alias name for an index can be used.
  • alias - The name of alias to return in the response. Like the index option, this option supports wildcards and the option the specify multiple alias names separated by a comma. This is a required option.
  • ignore_indices - What to do is an specified index name doesn't exist. If set to missing then those indices are ignored.

The rest endpoint is: /{index}/_alias/{alias}

Examples:
All aliases for the index users:

curl -XGET 'localhost:9200/users/_alias/*
 {
  "users" : {
    "aliases" : {
      "user_13" : {
        "filter" : {
          "term" : {
            "user_id" : 13
          }
        },
        "index_routing" : "13",
        "search_routing" : "13"
      },
      "user_14" : {
        "filter" : {
          "term" : {
            "user_id" : 14
          }
        },
        "index_routing" : "14",
        "search_routing" : "14"
      },
      "user_12" : {
        "filter" : {
          "term" : {
            "user_id" : 12
          }
        },
        "index_routing" : "12",
        "search_routing" : "12"
      }
    }
  }
}

All aliases with the name 2013 in any index:

curl -XGET 'localhost:9200/_alias/2013
{
  "logs_201304" : {
    "aliases" : {
      "2013" : { }
    }
  },
  "logs_201305" : {
    "aliases" : {
      "2013" : { }
    }
  }
}

All aliases that start with 2013_01 in any index

curl -XGET 'localhost:9200/_alias/2013_01*
{
  "logs_20130101" : {
    "aliases" : {
      "2013_01" : { }
    }
  }
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions