When I have indexed some data, and some fields are stored as long's, when I retrieve it with Java, they are converted to Java Integer values, not retained as longs, despite their storage type in the index.
I have searched here to find out a way of making sure they retain their index storage type, but have not found a satisfactory answer. I can always check the type of the incoming numeric types, but I would rather that the Elasticsearch Java API did that for me. Is there any way to do that?
Prior discussions of this say this is because the search results are returned as JSON with no typing information, so Elasticsearch depends on the JSON libraries it uses to do this, and small numbers are always Integers, big numbers Longs.
Is this the case? Is there anyway around this?
EDIT: I guess a better way to ask the above, and more general, is: Is there any way to force the Java API to Elasticsearch to return search hits as the same Java classes (within reason - Dates, Longs, etc) that they were indexed from?