Index routing alias on a field

Hi,

We have put routing on a index, like:

_routing: {
path: some_id
required: true
}

We'd like to have also an alias so that the client code is decoupled from
the index setup. But I don't managed to specify a field for routing, like
some_id, in an alias, other than a specific value.
I've tried:

{
"actions" : [
{
"add" : {
"index" : "test",
"alias" : "test_alias",
"routing" : {
"path": "some_id"
}
}
}
]
}'

And that doesn't seems to work. Is it possible to set a field as the
routing parameter for an index?
If I set the routing to some specific value of some_id, like 1, 2, it
works like a charm but it means we need to create an alias for every
possible value of some_id.

Thanks in advance.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/857bfc69-ffa2-4270-bb99-dc377a87de57%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

HI Han,

Setting a routing path on an alias is not possible. The reason is that an
alias also has to work for searches/reads where there is no context of a
document's content to resolve the routing value. Think for example of
search (/test_alias/_search) or document retrieval by ID (GET
/test_alias/type/1). Those

Cheers,
Boaz

On Sunday, December 29, 2013 11:08:02 AM UTC+1, Han JU wrote:

Hi,

We have put routing on a index, like:

_routing: {
path: some_id
required: true
}

We'd like to have also an alias so that the client code is decoupled from
the index setup. But I don't managed to specify a field for routing, like
some_id, in an alias, other than a specific value.
I've tried:

{
"actions" : [
{
"add" : {
"index" : "test",
"alias" : "test_alias",
"routing" : {
"path": "some_id"
}
}
}
]
}'

And that doesn't seems to work. Is it possible to set a field as the
routing parameter for an index?
If I set the routing to some specific value of some_id, like 1, 2, it
works like a charm but it means we need to create an alias for every
possible value of some_id.

Thanks in advance.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/367f7961-acc5-4fa5-9092-9654739f0012%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Thanks Boaz.
That makes sence. I'll add the routing information in our queries.

在 2013年12月30日星期一UTC+1上午9时05分49秒,Boaz Leskes写道:

HI Han,

Setting a routing path on an alias is not possible. The reason is that an
alias also has to work for searches/reads where there is no context of a
document's content to resolve the routing value. Think for example of
search (/test_alias/_search) or document retrieval by ID (GET
/test_alias/type/1). Those

Cheers,
Boaz

On Sunday, December 29, 2013 11:08:02 AM UTC+1, Han JU wrote:

Hi,

We have put routing on a index, like:

_routing: {
path: some_id
required: true
}

We'd like to have also an alias so that the client code is decoupled from
the index setup. But I don't managed to specify a field for routing, like
some_id, in an alias, other than a specific value.
I've tried:

{
"actions" : [
{
"add" : {
"index" : "test",
"alias" : "test_alias",
"routing" : {
"path": "some_id"
}
}
}
]
}'

And that doesn't seems to work. Is it possible to set a field as the
routing parameter for an index?
If I set the routing to some specific value of some_id, like 1, 2, it
works like a charm but it means we need to create an alias for every
possible value of some_id.

Thanks in advance.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/7e516f27-8a96-46a9-98e4-82825cb2e331%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.