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 <[email protected]> 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> | 
> @elasticsearchfr<https://twitter.com/elasticsearchfr>
>
>
> Le 21 février 2014 à 17:04:27, Mohit Anchlia ([email protected]) 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 <[email protected]> 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 ;-)
>> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
>>
>>
>> Le 21 févr. 2014 à 04:37, Mohit Anchlia <[email protected]> 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 <[email protected]> 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 [email protected].
>>> 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 [email protected].
>>  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 [email protected].
>> 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 [email protected].
> 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 [email protected].
> 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 [email protected].
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.

Reply via email to