# Query Results differ

**URL:** <https://discuss.elastic.co/t/query-results-differ/96984>\
**Category:** Elasticsearch\
**Created:** [August 14, 2017, 2:42pm UTC](https://discuss.elastic.co/t/query-results-differ/96984 "2017-08-14T14:42:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Velusamy\_Velu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/velusamy_velu/32/72364_2.png) [@Velusamy\_Velu](https://discuss.elastic.co/u/Velusamy_Velu)\
**Post date:** [August 14, 2017, 2:42pm UTC](https://discuss.elastic.co/t/query-results-differ/96984/1 "2017-08-14T14:42:42Z")

</div>

We're running ElasticSearch 5.5.1.

Here's an end point that returns an expected response  
http://:9200/index/indexType/AV3gv5yWc\_QVZ8-roTdU/

Response:

```
{  
   "_index":"chemistry",
   "_type":"layouts",
   "_id":"AV3gv5yWc_QVZ8-roTdU",
   "found":false
}

```

Would it be nice to have the same response when \_source is added to the end point?  
http://:9200/index/indexType/AV3gv5yWc\_QVZ8-roTdU/\_source

Instead the response is an exception:

```
javax.ws.rs.NotFoundException: HTTP 404 Not Found
	at org.glassfish.jersey.client.JerseyInvocation.convertToException(JerseyInvocation.java:1020)
	at org.glassfish.jersey.client.JerseyInvocation.translate(JerseyInvocation.java:819)
	at org.glassfish.jersey.client.JerseyInvocation.access$700(JerseyInvocation.java:92)
	at org.glassfish.jersey.client.JerseyInvocation$2.call(JerseyInvocation.java:701)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:315)

```

and so on...

It appears that the method that handles http://:9200/index/indexType/AV3gv5yWc\_QVZ8-roTdU/\_source doesn't handle the results right. It works well when a document matching that id is found but fails when found none. When searching by an ID **"found":false** is a valid return and it should be handled so. Throwing an exception appears to be wrong.

Any thoughts?

---

<div class="post-metadata">

**Author:** ![Velusamy\_Velu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/velusamy_velu/32/72364_2.png) [@Velusamy\_Velu](https://discuss.elastic.co/u/Velusamy_Velu)\
**Post date:** [August 15, 2017, 4:07pm UTC](https://discuss.elastic.co/t/query-results-differ/96984/2 "2017-08-15T16:07:08Z")

</div>

Could this be considered as a bug in ElasticSearch?

---

<div class="post-metadata">

**Author:** ![Velusamy\_Velu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/velusamy_velu/32/72364_2.png) [@Velusamy\_Velu](https://discuss.elastic.co/u/Velusamy_Velu)\
**Post date:** [August 15, 2017, 9:10pm UTC](https://discuss.elastic.co/t/query-results-differ/96984/3 "2017-08-15T21:10:59Z")

</div>

I did some additional investigation and conclude that it's not a bug. ElasticSearch returns the expected result.

If the request http://:9200/index/indexType/AV3gv5yWc\_QVZ8-roTdU/\_source ends in finding a document the **\_source** will be a valid content. If it doesn't point to any valid document then the response returned is

```
{
  "_index" : "<index>",
  "_type" : "<type>",
  "_id" : "AV3mqoBoPESFM3TzjmP",
  "found" : false
}

```

In this case \_source is missing for the right reasons, thus an empty string (my assumption) is returned. That seems to cause an error in Jersey.

Thanks for your attention.😀

---

<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:** [September 12, 2017, 9:11pm UTC](https://discuss.elastic.co/t/query-results-differ/96984/4 "2017-09-12T21:11:09Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
