# Document doesn't exist but appears in search results

**URL:** https://discuss.elastic.co/t/document-doesnt-exist-but-appears-in-search-results/12849
**Category:** Elasticsearch
**Created:** [July 18, 2013, 7:34pm UTC](https://discuss.elastic.co/t/document-doesnt-exist-but-appears-in-search-results/12849 "2013-07-18T19:34:58Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Paul\_Bellora](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paul_bellora/32/74372_2.png) [@Paul\_Bellora](https://discuss.elastic.co/u/Paul_Bellora)
#### Post date: [July 18, 2013, 7:34pm UTC](https://discuss.elastic.co/t/document-doesnt-exist-but-appears-in-search-results/12849/1 "2013-07-18T19:34:58Z")

</div>

I have a particular document in ES index that does or does not exist,  
depending on how I look for it.

If I try getting it:

curl localhost:9200/test/foo/123?pretty=true

It doesn't appear to exist:

{  
"\_index" : "test",  
"\_type" : "foo",  
"\_id" : "123",  
"exists" : false  
}

If I try searching for it:

curl localhost:9200/test/foo/\_search?pretty=true -d '{  
"query" : {  
"term" : { "\_id" : "123" }  
}  
}'

It's found:

{  
"took" : 3,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 1,  
"max\_score" : 1.0,  
"hits" : [ {  
"\_index" : "test",  
"\_type" : "foo",  
"\_id" : "123",  
"\_score" : 1.0, "\_source" : {"bar":"blah blah"}  
} ]  
}  
}

I haven't yet figured out the reproduction steps, but this particular  
document seems "stuck" in this weird state. Refreshing doesn't fix it. What  
could possibly lead to this situation?

--  
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: ![Paul\_Bellora](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paul_bellora/32/74372_2.png) [@Paul\_Bellora](https://discuss.elastic.co/u/Paul_Bellora)
#### Post date: [July 18, 2013, 8:19pm UTC](https://discuss.elastic.co/t/document-doesnt-exist-but-appears-in-search-results/12849/2 "2013-07-18T20:19:56Z")

</div>

This turned out to be a routing issue. The document type was a child of  
another type and I was forgetting to specify the parent id for routing of  
the get call.

On Thu, Jul 18, 2013 at 3:34 PM, Paul Bellora [bellorap@gmail.com](mailto:bellorap@gmail.com) wrote:

> I have a particular document in ES index that does or does not exist,  
> depending on how I look for it.
> 
> If I try getting it:
> 
> curl localhost:9200/test/foo/123?pretty=true
> 
> It doesn't appear to exist:
> 
> {  
> "\_index" : "test",  
> "\_type" : "foo",  
> "\_id" : "123",  
> "exists" : false  
> }
> 
> If I try searching for it:
> 
> curl localhost:9200/test/foo/\_search?pretty=true -d '{  
> "query" : {  
> "term" : { "\_id" : "123" }  
> }  
> }'
> 
> It's found:
> 
> {  
> "took" : 3,  
> "timed\_out" : false,  
> "\_shards" : {  
> "total" : 5,  
> "successful" : 5,  
> "failed" : 0  
> },  
> "hits" : {  
> "total" : 1,  
> "max\_score" : 1.0,  
> "hits" : [ {  
> "\_index" : "test",  
> "\_type" : "foo",  
> "\_id" : "123",  
> "\_score" : 1.0, "\_source" : {"bar":"blah blah"}  
> } ]  
> }  
> }
> 
> I haven't yet figured out the reproduction steps, but this particular  
> document seems "stuck" in this weird state. Refreshing doesn't fix it. What  
> could possibly lead to this situation?
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/ctv2LZqilSM/unsubscribe](https://groups.google.com/d/topic/elasticsearch/ctv2LZqilSM/unsubscribe).  
> To unsubscribe from this group and all its topics, 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: ![Paul\_Blakey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paul_blakey/32/2092_2.png) [@Paul\_Blakey](https://discuss.elastic.co/u/Paul_Blakey)
#### Post date: [September 17, 2013, 8:42pm UTC](https://discuss.elastic.co/t/document-doesnt-exist-but-appears-in-search-results/12849/3 "2013-09-17T20:42:17Z")

</div>

Thanks, this sorted an issue I was experiencing, Elasticsearch server was  
returning a 500 status (below), when trying to update a document created  
with this issue. The error now makes a lot more sense.

{

```
"status": 500,

"error": "NullPointerException[null]"

```

}

On Thursday, July 18, 2013 4:19:56 PM UTC-4, Paul Bellora wrote:

> This turned out to be a routing issue. The document type was a child of  
> another type and I was forgetting to specify the parent id for routing of  
> the get call.
> 
> On Thu, Jul 18, 2013 at 3:34 PM, Paul Bellora \<[bell...@gmail.com](mailto:bell...@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > I have a particular document in ES index that does or does not exist,  
> > depending on how I look for it.
> > 
> > If I try getting it:
> > 
> > curl localhost:9200/test/foo/123?pretty=true
> > 
> > It doesn't appear to exist:
> > 
> > {  
> > "\_index" : "test",  
> > "\_type" : "foo",  
> > "\_id" : "123",  
> > "exists" : false  
> > }
> > 
> > If I try searching for it:
> > 
> > curl localhost:9200/test/foo/\_search?pretty=true -d '{  
> > "query" : {  
> > "term" : { "\_id" : "123" }  
> > }  
> > }'
> > 
> > It's found:
> > 
> > {  
> > "took" : 3,  
> > "timed\_out" : false,  
> > "\_shards" : {  
> > "total" : 5,  
> > "successful" : 5,  
> > "failed" : 0  
> > },  
> > "hits" : {  
> > "total" : 1,  
> > "max\_score" : 1.0,  
> > "hits" : [ {  
> > "\_index" : "test",  
> > "\_type" : "foo",  
> > "\_id" : "123",  
> > "\_score" : 1.0, "\_source" : {"bar":"blah blah"}  
> > } ]  
> > }  
> > }
> > 
> > I haven't yet figured out the reproduction steps, but this particular  
> > document seems "stuck" in this weird state. Refreshing doesn't fix it. What  
> > could possibly lead to this situation?
> > 
> > --  
> > You received this message because you are subscribed to a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/ctv2LZqilSM/unsubscribe](https://groups.google.com/d/topic/elasticsearch/ctv2LZqilSM/unsubscribe).  
> > To unsubscribe from this group and all its topics, 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:15am UTC](https://discuss.elastic.co/t/document-doesnt-exist-but-appears-in-search-results/12849/4 "2017-07-06T02:15:54Z")

</div>


