Internally converting longs to ints?

I've noticed that if specify a field in ElasticSearch as a "long", when I
read the value back out via Java, sometimes the value is a Long, and
sometimes it is an Integer. It appears that ElasticSearch is internally
electing to store my long as an int (it's a small number), and when I read
it back out, my original type specification is not being honored. Is this
accurate? If so, do we have to worry about other types being downsized? I
think I've seen it with dates, too. Anything else?

To be a little more concrete, let's say I have a mapping like:

{
"testMapping" : {
"properties" : {
"fam0" : {
"type" : "nested",
"properties" : {
"field1" : {"type" : "long" },
}
}
}
}
}

Then, in Java, I have code that looks like:

{
...
Map<String, Object> esFamily;
long value = (Long)esFamily.get(columnName);
...
}

With small values for field1, this gets a ClassCastException (can't cast
Integer to Long). However, if I put big numbers into field1, it works fine.

Thanks,

Brian

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/c301bcaf-ddb5-4287-95d9-a5f72278f928%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.