0
votes

How to retrieve index name in elastic search based on some given aliases names. Example: Index_name: test Aliases names: a1,a2,a3 Index_name: test2 Aliases name: a1,a3 Index_name: test3 Aliases name: a1 retrieve the index name which has a1,a2,a3 in its alias names. expected from above example: test

1

1 Answers

0
votes

GET /alias_name returns a json with all the indices using the alias.

For this use case, you can try something like below.

curl -XGET <ES_URL>/_cat/aliases/a1,a2,a3 2>/dev/null | cut -d ' ' -f2 | uniq -c | grep "^[[:space:]]\+3"

The command prints only indices with all '3' aliases.