Get Index name based on Aliases

I have index which has multiple aliases names. And now i want to get all the index names which contain some given aliases names.
Example:
Index_name: test
Aliases name: a1,a2,a3

Index_name: test2
Aliases name: a1,a3

Index_name: test3
Aliases name: a1

Now i want to get all the index names which has a1,a2,a3 in its alias names.
expected from above example: test

Could someone please help me with the API/Query.

Depending on what you have named your aliases opposed to the examples shared of a1, a2, a3.
GET _alias/a* will return you something alike:

{
  "test1": {
    "aliases": {
      "alias1": {},
      "alias2": {},
      "alias3": {}
    }
  },
  "test3": {
    "aliases": {
      "alias1": {}
    }
  },
  "test2": {
    "aliases": {
      "alias1": {},
      "alias3": {}
    }
  }
}

Thanks @JKhondhu But this API gives me all the index names. I want to get only that index name which has all the aliases names in it. Like in above example i only want "test" index name as it contains all the three aliases a1,a2,a3.

Okay, if your aliases are named such as a1, a2, a3, then this will not help.
Perhaps get alias pertaining to index names?
GET test1,test2,test3/_alias

@JKhondhu I do not have index names with me at the time of searching. I get multiple aliases now i want to get the index name which contains all the aliases.(AND operator)

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.