How do I find the alias for an index in ElasticSearch -
I want to find an alias for a given index in ElasticSearch. In fact, the opposite of this question:
How did I do this? Map
// [alias = & gt; [Index = & gt; Metadata, ...], ...] ImmutableOpenMap & lt; String, Imitable Openmark & lt; String, alloyetadata & gt; & Gt; AliasesAndIndices = client.admin (). Cluster () .prepareState () carry about (). ActionGet (). GetState () .getMetaData (). GetAliases (); Maps & lt; String, string & gt; AliasForIndex = New Hashmap & lt; & Gt; (); // it is indexed to index = & gt; Change in a map of Nickname, ...] (string aliases: aliases and indeces.quote (). ToArray (string.class)) {imputable openmark & lt; String, alloyetadata & gt; Interiormap = alias and india.gate (alias); (String Index: Innermark. Keys) ToArray (string class)) {aliasForIndex.put (index, alias); }} And then I could get the nickname for an index like this.
aliasForIndex.get (index)
Comments
Post a Comment