SearchHit.sourceAsMap() maps longs as integer

Hello,

In ES I have a field of type long, confirmed by
curl -XGET 'http://clem-vbox:9200/sicap/abo/_mapping?pretty=true

But when I query ES and get the first SearchHit's map with :
hit.sourceAsMap().get("xxx"));

It returns me an Integer (and my test fails !) instead of Long.

Is it normal ?
Thx

Yes, thats what the json parsing does. When you index a document in elasticsearch, it gets translated to json and indexed, when you ask for it, it gets parsed back.

On Tuesday, June 21, 2011 at 10:32 AM, cnotin wrote:

Hello,

In ES I have a field of type long, confirmed by
curl -XGET 'http://clem-vbox:9200/sicap/abo/_mapping?pretty=true

But when I query ES and get the first SearchHit's map with :
hit.sourceAsMap().get("xxx"));

It returns me an Integer (and my test fails !) instead of Long.

Is it normal ?
Thx

--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/SearchHit-sourceAsMap-maps-longs-as-integer-tp3089616p3089616.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com (http://Nabble.com).

Ok so I assume that if a document contains a very long Int it will be parsed as Long.
Thx