Retrieving Index by Alias


(Alexander Kley) #1

Hi all,

is it possible to retrieve all indexes by their alias? I need the inverted
way like described in RestGetIndicesAliasesAction.class (Line 59). Such
give me all indices pointed to given alias.

Best regards
Alex

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Alexander Kley) #2

To be more concrete:

I'll be able to rebuild an index "my_index_v1" to "my_index_v2", pointed
to the alias "my_index". The process itself is well known by myself. My
problem is to calculate the next number for _v.. in a generic way.
So my idea was to get the index name, which is pointed to the known alias,
parse them, get the _v sufix and create a new index based on the result of
parsing, adding them to the alias,...... , remove the old index from alias.

Cheers
Alex

Am Montag, 4. November 2013 13:33:43 UTC+1 schrieb Alexander Kley:

Hi all,

is it possible to retrieve all indexes by their alias? I need the inverted
way like described in RestGetIndicesAliasesAction.class (Line 59). Such
give me all indices pointed to given alias.

Best regards
Alex

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Boaz Leskes) #3

Hey Alex,

Currently, your only option is to get all the aliases and filter to the one
you want.

Does sound like a good idea. Please feel free to open an issue on github.

Cheers,
Boaz

On Monday, November 4, 2013 1:33:43 PM UTC+1, Alexander Kley wrote:

Hi all,

is it possible to retrieve all indexes by their alias? I need the inverted
way like described in RestGetIndicesAliasesAction.class (Line 59). Such
give me all indices pointed to given alias.

Best regards
Alex

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Alexander Kley) #4

Thanks Boaz,

the problem is not the filtering, more the retrieving of alias "containg
indices"-data" :wink:

Am Montag, 4. November 2013 13:45:42 UTC+1 schrieb Boaz Leskes:

Hey Alex,

Currently, your only option is to get all the aliases and filter to the
one you want.

Does sound like a good idea. Please feel free to open an issue on github.

Cheers,
Boaz

On Monday, November 4, 2013 1:33:43 PM UTC+1, Alexander Kley wrote:

Hi all,

is it possible to retrieve all indexes by their alias? I need the
inverted way like described in RestGetIndicesAliasesAction.class (Line
59). Such give me all indices pointed to given alias.

Best regards
Alex

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Boaz Leskes) #5

Hi Alex,

Not sure I follow.

If you do curl -XGET "http://localhost:9200/_aliases/" , you get

{
"index1": {
"aliases": {
"alias1": {}
}
},
"index2": {
"aliases": {
"alias2": {},
"alias1": {}
}
}
}

Where you have all the information you need?

Cheers,
Boaz

On Mon, Nov 4, 2013 at 1:50 PM, Alexander Kley alexander.kley@gmail.comwrote:

Thanks Boaz,

the problem is not the filtering, more the retrieving of alias "containg
indices"-data" :wink:

Am Montag, 4. November 2013 13:45:42 UTC+1 schrieb Boaz Leskes:

Hey Alex,

Currently, your only option is to get all the aliases and filter to the
one you want.

Does sound like a good idea. Please feel free to open an issue on github.

Cheers,
Boaz

On Monday, November 4, 2013 1:33:43 PM UTC+1, Alexander Kley wrote:

Hi all,

is it possible to retrieve all indexes by their alias? I need the
inverted way like described in RestGetIndicesAliasesAction.class (Line
59). Such give me all indices pointed to given alias.

Best regards
Alex

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/UiJDLna89J8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Alexander Kley) #6

Ok that's an idea. But i'm using th java api. can you post the java api
call.

Cheers,
Alex

Am Montag, 4. November 2013 14:11:40 UTC+1 schrieb Boaz Leskes:

Hi Alex,

Not sure I follow.

If you do curl -XGET "http://localhost:9200/_aliases/" , you get

{
"index1": {
"aliases": {
"alias1": {}
}
},
"index2": {
"aliases": {
"alias2": {},
"alias1": {}
}
}
}

Where you have all the information you need?

Cheers,
Boaz

On Mon, Nov 4, 2013 at 1:50 PM, Alexander Kley <alexand...@gmail.com<javascript:>

wrote:

Thanks Boaz,

the problem is not the filtering, more the retrieving of alias "containg
indices"-data" :wink:

Am Montag, 4. November 2013 13:45:42 UTC+1 schrieb Boaz Leskes:

Hey Alex,

Currently, your only option is to get all the aliases and filter to the
one you want.

Does sound like a good idea. Please feel free to open an issue on github.

Cheers,
Boaz

On Monday, November 4, 2013 1:33:43 PM UTC+1, Alexander Kley wrote:

Hi all,

is it possible to retrieve all indexes by their alias? I need the
inverted way like described in RestGetIndicesAliasesAction**.class
(Line 59). Such give me all indices pointed to given alias.

Best regards
Alex

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/UiJDLna89J8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearc...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Boaz Leskes) #7

Well, the example is in the same RestGetIndicesAliasesAction you referred
to. You do a cluster state request:

client.admin().cluster().prepareState().setFilterNodes(true).setFilterRoutingTable(true).get()

The in the response:
MetaData metaData = response.getState().metaData();
for (IndexMetaData indexMetaData : metaData) ....

You'd have to look at indexMetaData.aliases().containsKey("alias")

Cheers,
Boaz

On Mon, Nov 4, 2013 at 2:48 PM, Alexander Kley alexander.kley@gmail.comwrote:

Ok that's an idea. But i'm using th java api. can you post the java api
call.

Cheers,
Alex

Am Montag, 4. November 2013 14:11:40 UTC+1 schrieb Boaz Leskes:

Hi Alex,

Not sure I follow.

If you do curl -XGET "http://localhost:9200/_aliases/" , you get

{
"index1": {
"aliases": {
"alias1": {}
}
},
"index2": {
"aliases": {
"alias2": {},
"alias1": {}
}
}
}

Where you have all the information you need?

Cheers,
Boaz

On Mon, Nov 4, 2013 at 1:50 PM, Alexander Kley alexand...@gmail.comwrote:

Thanks Boaz,

the problem is not the filtering, more the retrieving of alias "containg
indices"-data" :wink:

Am Montag, 4. November 2013 13:45:42 UTC+1 schrieb Boaz Leskes:

Hey Alex,

Currently, your only option is to get all the aliases and filter to the
one you want.

Does sound like a good idea. Please feel free to open an issue on
github.

Cheers,
Boaz

On Monday, November 4, 2013 1:33:43 PM UTC+1, Alexander Kley wrote:

Hi all,

is it possible to retrieve all indexes by their alias? I need the
inverted way like described in RestGetIndicesAliasesAction.class
(Line 59). Such give me all indices pointed to given alias.

Best regards
Alex

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit https://groups.google.com/d/
topic/elasticsearch/UiJDLna89J8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearc...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/UiJDLna89J8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Alexander Kley) #8

This could fix my problem - thanks! By the way, th key is "aliases".

Cheers,
Alex

Am Montag, 4. November 2013 15:32:40 UTC+1 schrieb Boaz Leskes:

Well, the example is in the same RestGetIndicesAliasesAction you referred
to. You do a cluster state request:

client.admin().cluster().prepareState().setFilterNodes(true).setFilterRoutingTable(true).get()

The in the response:
MetaData metaData = response.getState().metaData();
for (IndexMetaData indexMetaData : metaData) ....

You'd have to look at indexMetaData.aliases().containsKey("alias")

Cheers,
Boaz

On Mon, Nov 4, 2013 at 2:48 PM, Alexander Kley <alexand...@gmail.com<javascript:>

wrote:

Ok that's an idea. But i'm using th java api. can you post the java api
call.

Cheers,
Alex

Am Montag, 4. November 2013 14:11:40 UTC+1 schrieb Boaz Leskes:

Hi Alex,

Not sure I follow.

If you do curl -XGET "http://localhost:9200/_**aliases/http://localhost:9200/_aliases/"
, you get

{
"index1": {
"aliases": {
"alias1": {}
}
},
"index2": {
"aliases": {
"alias2": {},
"alias1": {}
}
}
}

Where you have all the information you need?

Cheers,
Boaz

On Mon, Nov 4, 2013 at 1:50 PM, Alexander Kley alexand...@gmail.comwrote:

Thanks Boaz,

the problem is not the filtering, more the retrieving of alias
"containg indices"-data" :wink:

Am Montag, 4. November 2013 13:45:42 UTC+1 schrieb Boaz Leskes:

Hey Alex,

Currently, your only option is to get all the aliases and filter to
the one you want.

Does sound like a good idea. Please feel free to open an issue on
github.

Cheers,
Boaz

On Monday, November 4, 2013 1:33:43 PM UTC+1, Alexander Kley wrote:

Hi all,

is it possible to retrieve all indexes by their alias? I need the
inverted way like described in RestGetIndicesAliasesAction****.class
(Line 59). Such give me all indices pointed to given alias.

Best regards
Alex

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit https://groups.google.com/d/**
topic/elasticsearch/**UiJDLna89J8/unsubscribehttps://groups.google.com/d/topic/elasticsearch/UiJDLna89J8/unsubscribe
.
To unsubscribe from this group and all its topics, send an email to
elasticsearc...@**googlegroups.com.

For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
.

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/UiJDLna89J8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearc...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #9