Routing by diferent fields


(silvina) #1

Hi,
Is it possible search data with diferent routing field in the same index?.
For example, I would like make search and set the routing by person_id and
other search with item_id.
index1/search?routing=person_id
index1/search?routing=item_id

Do I need create another index?
Thanks,
Silvina.

--
(_/)
(='.'=)
(")
(")

--
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.


(David Pilato) #2

Are you looking for index/_search?routing=person_id,item_id
See: http://www.elasticsearch.org/guide/reference/api/search/

It could perform search on two shards (or one if the two keys goes to the same shard).

Does it help?

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 28 sept. 2013 à 00:45, silvina svlucero@gmail.com a écrit :

Hi,
Is it possible search data with diferent routing field in the same index?. For example, I would like make search and set the routing by person_id and other search with item_id.
index1/search?routing=person_id
index1/search?routing=item_id

Do I need create another index?
Thanks,
Silvina.

--
(_/)
(='.'=)
(")
(")

--
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.

--
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.


(silvina) #3

Any idea about that?

On Fri, Sep 27, 2013 at 6:45 PM, silvina svlucero@gmail.com wrote:

Hi,
Is it possible search data with diferent routing field in the same
index?. For example, I would like make search and set the routing by
person_id and other search with item_id.
index1/search?routing=person_id
index1/search?routing=item_id

Do I need create another index?
Thanks,
Silvina.

--
(_/)
(='.'=)
(")
(")

--
(_/)
(='.'=)
(")
(")

--
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.


(silvina) #4

Thanks David,
No, I need make diferents search, sometimes routing by person_id and
sometimes by item_id on the same index when the shards where index by
item_id. It is possible? Can I search by different fields?

El viernes, 27 de septiembre de 2013 21:24:53 UTC-3, David Pilato escribió:

Are you looking for index/_search?routing=person_id,item_id
See: http://www.elasticsearch.org/guide/reference/api/search/

It could perform search on two shards (or one if the two keys goes to the
same shard).

Does it help?

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 28 sept. 2013 à 00:45, silvina <svlu...@gmail.com <javascript:>> a
écrit :

Hi,
Is it possible search data with diferent routing field in the same
index?. For example, I would like make search and set the routing by
person_id and other search with item_id.
index1/search?routing=person_id
index1/search?routing=item_id

Do I need create another index?
Thanks,
Silvina.

--
(_/)
(='.'=)
(")
(")

--
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 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.


(David Pilato) #5

Sorry. I don't understand.
May be you could illustrate with a concrete example?

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 2 oct. 2013 à 21:01, anivlis svlucero@gmail.com a écrit :

Thanks David,
No, I need make diferents search, sometimes routing by person_id and sometimes by item_id on the same index when the shards where index by item_id. It is possible? Can I search by different fields?

El viernes, 27 de septiembre de 2013 21:24:53 UTC-3, David Pilato escribió:

Are you looking for index/_search?routing=person_id,item_id
See: http://www.elasticsearch.org/guide/reference/api/search/

It could perform search on two shards (or one if the two keys goes to the same shard).

Does it help?

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 28 sept. 2013 à 00:45, silvina svlu...@gmail.com a écrit :

Hi,
Is it possible search data with diferent routing field in the same index?. For example, I would like make search and set the routing by person_id and other search with item_id.
index1/search?routing=person_id
index1/search?routing=item_id

Do I need create another index?
Thanks,
Silvina.

--
(_/)
(='.'=)
(")
(")

--
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 elasticsearc...@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.

--
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.


(silvina) #6

I have a elasticsearch with 16 shard and 2 replications. I index data with
routing:

            "_routing" : {
                "required" : true,
                "path" : "item_id"
        }

But when I'm looking for documents routed by a different field (person_id)
the result is a part of the total result. For example, I have 100 documents
with person_id=1 but only 10 are in the result set. I think this happen
because the data is not in the same shard so when elasticsearch is routing
by a person_id then only one shard is visited and the rest is ignored.
How can be sure that when routing by different field the result set is
complete?

El miércoles, 2 de octubre de 2013 16:38:55 UTC-3, David Pilato escribió:

Sorry. I don't understand.
May be you could illustrate with a concrete example?

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 2 oct. 2013 à 21:01, anivlis <svlu...@gmail.com <javascript:>> a
écrit :

Thanks David,
No, I need make diferents search, sometimes routing by person_id and
sometimes by item_id on the same index when the shards where index by
item_id. It is possible? Can I search by different fields?

El viernes, 27 de septiembre de 2013 21:24:53 UTC-3, David Pilato escribió:

Are you looking for index/_search?routing=person_id,item_id
See: http://www.elasticsearch.org/guide/reference/api/search/

It could perform search on two shards (or one if the two keys goes to the
same shard).

Does it help?

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 28 sept. 2013 à 00:45, silvina svlu...@gmail.com a écrit :

Hi,
Is it possible search data with diferent routing field in the same
index?. For example, I would like make search and set the routing by
person_id and other search with item_id.
index1/search?routing=person_id
index1/search?routing=item_id

Do I need create another index?
Thanks,
Silvina.

--
(_/)
(='.'=)
(")
(")

--
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 elasticsearc...@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 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.


(Jörg Prante) #7

If you index with routing, you place a doc by a fixed key into a shard.
Think of the distribution as a partition pattern that is immutable. If you
use another key for the distribution and not the one you used while
indexing, you will clearly not be able to find all documents. It's like a
door with a key - only one key fits into the lock.

Routing is not filtering. Maybe you just want to filter docs by different
fields.

Jörg

--
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.


(silvina) #8

Thanks jorg,
I don't want scan all shards when I make a search. In that case, which is
the best solution? Maybe I need create another index with different
routing.

El miércoles, 2 de octubre de 2013 18:12:30 UTC-3, Jörg Prante escribió:

If you index with routing, you place a doc by a fixed key into a shard.
Think of the distribution as a partition pattern that is immutable. If you
use another key for the distribution and not the one you used while
indexing, you will clearly not be able to find all documents. It's like a
door with a key - only one key fits into the lock.

Routing is not filtering. Maybe you just want to filter docs by different
fields.

Jörg

--
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