Efficiency of GET by doc id

When using routing is GET by doc id still efficient? I am assuming when
routing is used the hash algorithm uses routing value instead of doc value
so based on that fact is the GET by doc id still efficient?

--
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/CAOT3TWqOZxnaCVTD14YW%2B2QpMxPcx%3DAn77UVsSZZSg-0T74enw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

The only difference is in one case the doc ID is used to hash, and in the
routing case the routing ID is used to hash. Other than that, execution is
the same between the two.

--
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/eb3ac73f-8e31-49b6-9106-3bdf830dbe6f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

I understand that, but my question was the execution path during GET when
using docid which was indexed with routing id. Does it search all the
shards?

On Thu, Feb 20, 2014 at 3:49 PM, Binh Ly binh@hibalo.com wrote:

The only difference is in one case the doc ID is used to hash, and in the
routing case the routing ID is used to hash. Other than that, execution is
the same between the two.

--
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/eb3ac73f-8e31-49b6-9106-3bdf830dbe6f%40googlegroups.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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAOT3TWoR1GqyJSSeODdvPu7wK2HswjjbOfr5RtQQSZzyq%2B4QtA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Not sure I follow, but if routing is supplied, the routing value will be
used to hash to a single shard on which the GET is performed on. If routing
is not supplied, the doc ID will be used to hash to a single shard on which
the GET is performed on. In either case, 1 shard is used to GET the
document.

--
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/667559d8-5c0d-471f-ad54-a68eff38c8bc%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

How does hash algorithm work on 2 variable at the same time? For eg:

  1. insert a doc with route value 1
  2. ES creates doc id "A"
  3. Send a GET for doc id "A" with no routing value - In this case how is ES
    able to find just one shard since it doesn't have routing value that it can
    use to find the shard? In other word if doc A was inserted using hash of
    value 1 then how can it find that one shard when a request comes in with no
    routing value?

On Thu, Feb 20, 2014 at 6:42 PM, Binh Ly binh@hibalo.com wrote:

Not sure I follow, but if routing is supplied, the routing value will be
used to hash to a single shard on which the GET is performed on. If routing
is not supplied, the doc ID will be used to hash to a single shard on which
the GET is performed on. In either case, 1 shard is used to GET the
document.

--
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/667559d8-5c0d-471f-ad54-a68eff38c8bc%40googlegroups.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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAOT3TWpQkg3EYkyEJzmDAE%2BdoTPbzPsG9zJGfrfbTjgq2GE19Q%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Es will route your doc to shard corresponding to routing value 1.
If you search for docA without routing value, 2 options:

You are lucky: hash id A correspond to the same shard as routing value 1: you get the doc
You are not: you won't find the doc.

So, when using routing value at index time, you must give routing value at GET time.

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

Le 21 févr. 2014 à 04:37, Mohit Anchlia mohitanchlia@gmail.com a écrit :

How does hash algorithm work on 2 variable at the same time? For eg:

  1. insert a doc with route value 1
  2. ES creates doc id "A"
  3. Send a GET for doc id "A" with no routing value - In this case how is ES able to find just one shard since it doesn't have routing value that it can use to find the shard? In other word if doc A was inserted using hash of value 1 then how can it find that one shard when a request comes in with no routing value?

On Thu, Feb 20, 2014 at 6:42 PM, Binh Ly binh@hibalo.com wrote:
Not sure I follow, but if routing is supplied, the routing value will be used to hash to a single shard on which the GET is performed on. If routing is not supplied, the doc ID will be used to hash to a single shard on which the GET is performed on. In either case, 1 shard is used to GET the document.

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/667559d8-5c0d-471f-ad54-a68eff38c8bc%40googlegroups.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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAOT3TWpQkg3EYkyEJzmDAE%2BdoTPbzPsG9zJGfrfbTjgq2GE19Q%40mail.gmail.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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/8A4925F4-0492-4931-8C33-780815BFE692%40pilato.fr.
For more options, visit https://groups.google.com/groups/opt_out.

That clears things up. Thanks!

Is there a way to be able to create a doc such that one can find the
document with the id and without routing value? May be by using docId as a
field in the indexed doc?

On Thu, Feb 20, 2014 at 10:28 PM, David Pilato david@pilato.fr wrote:

Es will route your doc to shard corresponding to routing value 1.
If you search for docA without routing value, 2 options:

You are lucky: hash id A correspond to the same shard as routing value 1:
you get the doc
You are not: you won't find the doc.

So, when using routing value at index time, you must give routing value at
GET time.

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

Le 21 févr. 2014 à 04:37, Mohit Anchlia mohitanchlia@gmail.com a écrit :

How does hash algorithm work on 2 variable at the same time? For eg:

  1. insert a doc with route value 1
  2. ES creates doc id "A"
  3. Send a GET for doc id "A" with no routing value - In this case how is
    ES able to find just one shard since it doesn't have routing value that it
    can use to find the shard? In other word if doc A was inserted using hash
    of value 1 then how can it find that one shard when a request comes in with
    no routing value?

On Thu, Feb 20, 2014 at 6:42 PM, Binh Ly binh@hibalo.com wrote:

Not sure I follow, but if routing is supplied, the routing value will be
used to hash to a single shard on which the GET is performed on. If routing
is not supplied, the doc ID will be used to hash to a single shard on which
the GET is performed on. In either case, 1 shard is used to GET the
document.

--
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/667559d8-5c0d-471f-ad54-a68eff38c8bc%40googlegroups.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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAOT3TWpQkg3EYkyEJzmDAE%2BdoTPbzPsG9zJGfrfbTjgq2GE19Q%40mail.gmail.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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/8A4925F4-0492-4931-8C33-780815BFE692%40pilato.fr
.

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAOT3TWp2Du8MF%3DmZrCCVSyb8r4N%2B%3D6cucS3eWYBR20gn1_j2og%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

I guess that in that case you should index "_id" field (mapping) and run a search on "_id"?

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr

Le 21 février 2014 à 17:04:27, Mohit Anchlia (mohitanchlia@gmail.com) a écrit:

That clears things up. Thanks!

Is there a way to be able to create a doc such that one can find the document with the id and without routing value? May be by using docId as a field in the indexed doc?

On Thu, Feb 20, 2014 at 10:28 PM, David Pilato david@pilato.fr wrote:
Es will route your doc to shard corresponding to routing value 1.
If you search for docA without routing value, 2 options:

You are lucky: hash id A correspond to the same shard as routing value 1: you get the doc
You are not: you won't find the doc.

So, when using routing value at index time, you must give routing value at GET time.

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

Le 21 févr. 2014 à 04:37, Mohit Anchlia mohitanchlia@gmail.com a écrit :

How does hash algorithm work on 2 variable at the same time? For eg:

  1. insert a doc with route value 1
  2. ES creates doc id "A"
  3. Send a GET for doc id "A" with no routing value - In this case how is ES able to find just one shard since it doesn't have routing value that it can use to find the shard? In other word if doc A was inserted using hash of value 1 then how can it find that one shard when a request comes in with no routing value?

On Thu, Feb 20, 2014 at 6:42 PM, Binh Ly binh@hibalo.com wrote:
Not sure I follow, but if routing is supplied, the routing value will be used to hash to a single shard on which the GET is performed on. If routing is not supplied, the doc ID will be used to hash to a single shard on which the GET is performed on. In either case, 1 shard is used to GET the document.

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/667559d8-5c0d-471f-ad54-a68eff38c8bc%40googlegroups.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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAOT3TWpQkg3EYkyEJzmDAE%2BdoTPbzPsG9zJGfrfbTjgq2GE19Q%40mail.gmail.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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/8A4925F4-0492-4931-8C33-780815BFE692%40pilato.fr.

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAOT3TWp2Du8MF%3DmZrCCVSyb8r4N%2B%3D6cucS3eWYBR20gn1_j2og%40mail.gmail.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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/etPan.53077cfb.41a7c4c9.5655%40MacBook-Air-de-David.local.
For more options, visit https://groups.google.com/groups/opt_out.

David has the ideal solution, however just wanted to point out one key
difference in the get API is that it would look for a document in the
transaction log before it looks in the index. So if you execute a search
query after an insert, but before a refresh/flush, you will not see the
changes. This scenario depends on each individual use case and settings.
Probably a non-issue with the default refresh rate of 1 second and normal
search constraints.

--
Ivan

On Fri, Feb 21, 2014 at 8:21 AM, David Pilato david@pilato.fr wrote:

I guess that in that case you should index "_id" field (mapping) and run a
search on "_id"?

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr

Le 21 février 2014 à 17:04:27, Mohit Anchlia (mohitanchlia@gmail.com) a
écrit:

That clears things up. Thanks!

Is there a way to be able to create a doc such that one can find the
document with the id and without routing value? May be by using docId as a
field in the indexed doc?

On Thu, Feb 20, 2014 at 10:28 PM, David Pilato david@pilato.fr wrote:

Es will route your doc to shard corresponding to routing value 1.
If you search for docA without routing value, 2 options:

You are lucky: hash id A correspond to the same shard as routing value 1:
you get the doc
You are not: you won't find the doc.

So, when using routing value at index time, you must give routing value
at GET time.

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

Le 21 févr. 2014 à 04:37, Mohit Anchlia mohitanchlia@gmail.com a
écrit :

How does hash algorithm work on 2 variable at the same time? For eg:

  1. insert a doc with route value 1
  2. ES creates doc id "A"
  3. Send a GET for doc id "A" with no routing value - In this case how is
    ES able to find just one shard since it doesn't have routing value that it
    can use to find the shard? In other word if doc A was inserted using hash
    of value 1 then how can it find that one shard when a request comes in with
    no routing value?

On Thu, Feb 20, 2014 at 6:42 PM, Binh Ly binh@hibalo.com wrote:

Not sure I follow, but if routing is supplied, the routing value will be
used to hash to a single shard on which the GET is performed on. If routing
is not supplied, the doc ID will be used to hash to a single shard on which
the GET is performed on. In either case, 1 shard is used to GET the
document.

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/667559d8-5c0d-471f-ad54-a68eff38c8bc%40googlegroups.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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAOT3TWpQkg3EYkyEJzmDAE%2BdoTPbzPsG9zJGfrfbTjgq2GE19Q%40mail.gmail.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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/8A4925F4-0492-4931-8C33-780815BFE692%40pilato.fr.

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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAOT3TWp2Du8MF%3DmZrCCVSyb8r4N%2B%3D6cucS3eWYBR20gn1_j2og%40mail.gmail.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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/etPan.53077cfb.41a7c4c9.5655%40MacBook-Air-de-David.local
.

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBx0GDz5yv7vQ9L%3Df3_-uy5sgHQvoPvQ__T9cUvmbV5KA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

+1 I forget to mention it… But he was asking for searching a doc, not getting a doc :slight_smile:

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr

Le 21 février 2014 à 18:03:58, Ivan Brusic (ivan@brusic.com) a écrit:

David has the ideal solution, however just wanted to point out one key difference in the get API is that it would look for a document in the transaction log before it looks in the index. So if you execute a search query after an insert, but before a refresh/flush, you will not see the changes. This scenario depends on each individual use case and settings. Probably a non-issue with the default refresh rate of 1 second and normal search constraints.

--
Ivan

On Fri, Feb 21, 2014 at 8:21 AM, David Pilato david@pilato.fr wrote:
I guess that in that case you should index "_id" field (mapping) and run a search on "_id"?

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr

Le 21 février 2014 à 17:04:27, Mohit Anchlia (mohitanchlia@gmail.com) a écrit:

That clears things up. Thanks!

Is there a way to be able to create a doc such that one can find the document with the id and without routing value? May be by using docId as a field in the indexed doc?

On Thu, Feb 20, 2014 at 10:28 PM, David Pilato david@pilato.fr wrote:
Es will route your doc to shard corresponding to routing value 1.
If you search for docA without routing value, 2 options:

You are lucky: hash id A correspond to the same shard as routing value 1: you get the doc
You are not: you won't find the doc.

So, when using routing value at index time, you must give routing value at GET time.

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

Le 21 févr. 2014 à 04:37, Mohit Anchlia mohitanchlia@gmail.com a écrit :

How does hash algorithm work on 2 variable at the same time? For eg:

  1. insert a doc with route value 1
  2. ES creates doc id "A"
  3. Send a GET for doc id "A" with no routing value - In this case how is ES able to find just one shard since it doesn't have routing value that it can use to find the shard? In other word if doc A was inserted using hash of value 1 then how can it find that one shard when a request comes in with no routing value?

On Thu, Feb 20, 2014 at 6:42 PM, Binh Ly binh@hibalo.com wrote:
Not sure I follow, but if routing is supplied, the routing value will be used to hash to a single shard on which the GET is performed on. If routing is not supplied, the doc ID will be used to hash to a single shard on which the GET is performed on. In either case, 1 shard is used to GET the document.

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/667559d8-5c0d-471f-ad54-a68eff38c8bc%40googlegroups.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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAOT3TWpQkg3EYkyEJzmDAE%2BdoTPbzPsG9zJGfrfbTjgq2GE19Q%40mail.gmail.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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/8A4925F4-0492-4931-8C33-780815BFE692%40pilato.fr.

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAOT3TWp2Du8MF%3DmZrCCVSyb8r4N%2B%3D6cucS3eWYBR20gn1_j2og%40mail.gmail.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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/etPan.53077cfb.41a7c4c9.5655%40MacBook-Air-de-David.local.

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBx0GDz5yv7vQ9L%3Df3_-uy5sgHQvoPvQ__T9cUvmbV5KA%40mail.gmail.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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/etPan.53078e7b.2443a858.5655%40MacBook-Air-de-David.local.
For more options, visit https://groups.google.com/groups/opt_out.

Thanks for mentioning that. I was really thinking that there might be some
magic :slight_smile: and I would be able to do a GET by ID but without a routing value.
I was trying to avoid search on id since that now requires touching all the
shards.

On Fri, Feb 21, 2014 at 9:35 AM, David Pilato david@pilato.fr wrote:

+1 I forget to mention it... But he was asking for searching a doc, not
getting a doc :slight_smile:

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr

Le 21 février 2014 à 18:03:58, Ivan Brusic (ivan@brusic.com) a écrit:

David has the ideal solution, however just wanted to point out one key
difference in the get API is that it would look for a document in the
transaction log before it looks in the index. So if you execute a search
query after an insert, but before a refresh/flush, you will not see the
changes. This scenario depends on each individual use case and settings.
Probably a non-issue with the default refresh rate of 1 second and normal
search constraints.

--
Ivan

On Fri, Feb 21, 2014 at 8:21 AM, David Pilato david@pilato.fr wrote:

I guess that in that case you should index "_id" field (mapping) and
run a search on "_id"?

 --

David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr

Le 21 février 2014 à 17:04:27, Mohit Anchlia (mohitanchlia@gmail.com) a
écrit:

That clears things up. Thanks!

Is there a way to be able to create a doc such that one can find the
document with the id and without routing value? May be by using docId as a
field in the indexed doc?

On Thu, Feb 20, 2014 at 10:28 PM, David Pilato david@pilato.fr wrote:

Es will route your doc to shard corresponding to routing value 1.
If you search for docA without routing value, 2 options:

You are lucky: hash id A correspond to the same shard as routing value
1: you get the doc
You are not: you won't find the doc.

So, when using routing value at index time, you must give routing value
at GET time.

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

Le 21 févr. 2014 à 04:37, Mohit Anchlia mohitanchlia@gmail.com a
écrit :

How does hash algorithm work on 2 variable at the same time? For eg:

  1. insert a doc with route value 1
  2. ES creates doc id "A"
  3. Send a GET for doc id "A" with no routing value - In this case how is
    ES able to find just one shard since it doesn't have routing value that it
    can use to find the shard? In other word if doc A was inserted using hash
    of value 1 then how can it find that one shard when a request comes in with
    no routing value?

On Thu, Feb 20, 2014 at 6:42 PM, Binh Ly binh@hibalo.com wrote:

Not sure I follow, but if routing is supplied, the routing value will
be used to hash to a single shard on which the GET is performed on. If
routing is not supplied, the doc ID will be used to hash to a single shard
on which the GET is performed on. In either case, 1 shard is used to GET
the document.

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/667559d8-5c0d-471f-ad54-a68eff38c8bc%40googlegroups.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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAOT3TWpQkg3EYkyEJzmDAE%2BdoTPbzPsG9zJGfrfbTjgq2GE19Q%40mail.gmail.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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/8A4925F4-0492-4931-8C33-780815BFE692%40pilato.fr.

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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAOT3TWp2Du8MF%3DmZrCCVSyb8r4N%2B%3D6cucS3eWYBR20gn1_j2og%40mail.gmail.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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/etPan.53077cfb.41a7c4c9.5655%40MacBook-Air-de-David.local.

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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBx0GDz5yv7vQ9L%3Df3_-uy5sgHQvoPvQ__T9cUvmbV5KA%40mail.gmail.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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/etPan.53078e7b.2443a858.5655%40MacBook-Air-de-David.local
.

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAOT3TWrP4B-NMME78DNd%2BoH1%2BAKaM48it0yANDo-ejLLvSuLyA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.