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

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

Closed
martijnvg opened this issue May 23, 2013 · 0 comments
Closed

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

martijnvg opened this issue May 23, 2013 · 0 comments

Comments

@martijnvg
Copy link
Member

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" : { }
    }
  }
}
@ghost ghost assigned martijnvg May 23, 2013
martijnvg added a commit that referenced this issue May 23, 2013
Added apis to get specific index aliases based on filtering by alias name and index name:
```
curl -XGET 'localhost:9200/{index_or_alias}/_alias/{alias_name}'
```

Added delete index alias api for deleting a single index alias:
```
curl -XDELETE 'localhost:9200/{index}/_alias/{alias_name}'
```

Added create index alias api for adding a single index alias:
```
curl -XPUT 'localhost:9200/{index}/_alias/{alias_name}'

curl -XPUT 'localhost:9200/{index}/_alias/{alias_name}' -d '{
	"routing" : {routing},
	"filter" : {filter}
}'

```

Closes #3075 #3076 #3077
mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015
Added apis to get specific index aliases based on filtering by alias name and index name:
```
curl -XGET 'localhost:9200/{index_or_alias}/_alias/{alias_name}'
```

Added delete index alias api for deleting a single index alias:
```
curl -XDELETE 'localhost:9200/{index}/_alias/{alias_name}'
```

Added create index alias api for adding a single index alias:
```
curl -XPUT 'localhost:9200/{index}/_alias/{alias_name}'

curl -XPUT 'localhost:9200/{index}/_alias/{alias_name}' -d '{
	"routing" : {routing},
	"filter" : {filter}
}'

```

Closes elastic#3075 elastic#3076 elastic#3077
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant