# GET API doesn't return for some documents even if they exist

**URL:** <https://discuss.elastic.co/t/get-api-doesnt-return-for-some-documents-even-if-they-exist/10831>\
**Category:** Elasticsearch\
**Created:** [February 21, 2013, 12:29am UTC](https://discuss.elastic.co/t/get-api-doesnt-return-for-some-documents-even-if-they-exist/10831 "2013-02-21T00:29:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Burak\_Emre\_Kabakci](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/burak_emre_kabakci/32/2212_2.png) [@Burak\_Emre\_Kabakci](https://discuss.elastic.co/u/Burak_Emre_Kabakci)\
**Post date:** [February 21, 2013, 12:29am UTC](https://discuss.elastic.co/t/get-api-doesnt-return-for-some-documents-even-if-they-exist/10831/1 "2013-02-21T00:29:31Z")

</div>

When I use filter query like this:  
url: [http://localhost:9200/index/type/\_search/](http://localhost:9200/index/type/_search/)  
{  
"filter": {  
"term": {  
"\_id": 53454353  
}  
}  
}

Elasticsearch returns the document that has that id. However when I try to  
fetch a specific document via GET API it returns:

url: [http://localhost:9200/index/type/53454353/](http://localhost:9200/index/type/53454353/)  
{  
\_index: index  
\_type: type  
\_id: 53454353  
exists: false  
}

The "type" has a \_parent field and I suspect that it might cause a problem  
in GET API. Any suggestion?

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![mattweber](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mattweber/32/44940_2.png) [@mattweber](https://discuss.elastic.co/u/mattweber)\
**Post date:** [February 21, 2013, 12:36am UTC](https://discuss.elastic.co/t/get-api-doesnt-return-for-some-documents-even-if-they-exist/10831/2 "2013-02-21T00:36:04Z")

</div>

Specify the routing parameter set to the value of the parent for that  
document.

curl -XGET '[http://localhost:9200/index/type/5345353?routing=123](http://localhost:9200/index/type/5345353?routing=123)'

On Wed, Feb 20, 2013 at 4:29 PM, Burak Emre Kabakcı  
[emrekabakci@gmail.com](mailto:emrekabakci@gmail.com) wrote:

> When I use filter query like this:  
> url: [http://localhost:9200/index/type/\_search/](http://localhost:9200/index/type/_search/)  
> {  
> "filter": {  
> "term": {  
> "\_id": 53454353  
> }  
> }  
> }
> 
> Elasticsearch returns the document that has that id. However when I try to  
> fetch a specific document via GET API it returns:
> 
> url: [http://localhost:9200/index/type/53454353/](http://localhost:9200/index/type/53454353/)  
> {  
> \_index: index  
> \_type: type  
> \_id: 53454353  
> exists: false  
> }
> 
> The "type" has a \_parent field and I suspect that it might cause a problem  
> in GET API. Any suggestion?
> 
> --  
> 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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Burak\_Emre\_Kabakci](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/burak_emre_kabakci/32/2212_2.png) [@Burak\_Emre\_Kabakci](https://discuss.elastic.co/u/Burak_Emre_Kabakci)\
**Post date:** [February 21, 2013, 12:46am UTC](https://discuss.elastic.co/t/get-api-doesnt-return-for-some-documents-even-if-they-exist/10831/3 "2013-02-21T00:46:06Z")

</div>

I was thinking specifying the routing field makes the query faster but it  
seems I have to specify it to be able to use GET API. Thanks.

From [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/get.html)

> The above will get a tweet with id 1, but will be routed based on the  
> user. Note, issuing a get without the correct routing, will cause the  
> document not to be fetched

On Thursday, February 21, 2013 2:36:04 AM UTC+2, Matt Weber wrote:

> Specify the routing parameter set to the value of the parent for that  
> document.
> 
> curl -XGET '[http://localhost:9200/index/type/5345353?routing=123](http://localhost:9200/index/type/5345353?routing=123)'
> 
> On Wed, Feb 20, 2013 at 4:29 PM, Burak Emre Kabakcı  
> \<[emrek...@gmail.com](mailto:emrek...@gmail.com) \<javascript:\>\> wrote:
> 
> > When I use filter query like this:  
> > url: [http://localhost:9200/index/type/\_search/](http://localhost:9200/index/type/_search/)  
> > {  
> > "filter": {  
> > "term": {  
> > "\_id": 53454353  
> > }  
> > }  
> > }
> > 
> > Elasticsearch returns the document that has that id. However when I try  
> > to  
> > fetch a specific document via GET API it returns:
> > 
> > url: [http://localhost:9200/index/type/53454353/](http://localhost:9200/index/type/53454353/)  
> > {  
> > \_index: index  
> > \_type: type  
> > \_id: 53454353  
> > exists: false  
> > }
> > 
> > The "type" has a \_parent field and I suspect that it might cause a  
> > problem  
> > in GET API. Any suggestion?
> > 
> > --  
> > 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](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 2:50am UTC](https://discuss.elastic.co/t/get-api-doesnt-return-for-some-documents-even-if-they-exist/10831/4 "2017-07-06T02:50:25Z")

</div>


