Query Results differ

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?

Could this be considered as a bug in ElasticSearch?

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.:grinning:

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