Long field is returned as integer if the value is less in Java API

Hi,

I am querying the document which contains long field. If the long field
contains lesser values like 1, the java api returns integer object but if
the values are high like 999999999999999999, the java api returns long
object.

Is there anyway to consistently get the long object regardless of the value
of the field?

Regards,
Deepak

--

HI Deepak,

I had a similar problem to this - what is the mapping according to the
index?
://_mapping

Check for the field you want and see what the mapping type is

I updated the mapping for my index to use a certain data type only and then
it seemed to return ok.

Also, how are you checking that it returns an int vs long - class name
checking on the returned object?

Note, i'm a pretty new ES user!

Derry

On Tuesday, 25 September 2012 07:24:03 UTC+1, Deepak Chezhian wrote:

Hi,

I am querying the document which contains long field. If the long field
contains lesser values like 1, the java api returns integer object but if
the values are high like 999999999999999999, the java api returns long
object.

Is there anyway to consistently get the long object regardless of the
value of the field?

Regards,
Deepak

--

Hi Derry,

The field type seems to be fine. PFB for the mapping.

"store_id" : { "type" : "long", "ignore_malformed" : false }

I am getting the following exception when i tried to access that field with value "1" using Java API term query

java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long

The long datatype is returned as excepted after updating that field in the same document with value "999999999999999999". Based on this, i suspect ES is returning the datatype(atlease incase of int/long) based on the value in the field.

Anyway of avoiding this?

Regards,

Deepak

On Tuesday, 25 September 2012 11:18:51 UTC+4, Derry O' Sullivan wrote:

HI Deepak,

I had a similar problem to this - what is the mapping according to the
index?
://_mapping

Check for the field you want and see what the mapping type is

I updated the mapping for my index to use a certain data type only and
then it seemed to return ok.
Elasticsearch Platform — Find real-time answers at scale | Elastic

Also, how are you checking that it returns an int vs long - class name
checking on the returned object?

Note, i'm a pretty new ES user!

Derry

On Tuesday, 25 September 2012 07:24:03 UTC+1, Deepak Chezhian wrote:

Hi,

I am querying the document which contains long field. If the long field
contains lesser values like 1, the java api returns integer object but if
the values are high like 999999999999999999, the java api returns long
object.

Is there anyway to consistently get the long object regardless of the
value of the field?

Regards,
Deepak

--

Hi Deepak,

I got the reverse problem (long to int) as i had loaded some content with
long like fields (ES guessed the type as long) and compared to the int
field values in another index. When i forced the data type to be int (by
deleting/reindexing the content), everything seemed to be fine.

Are you getting this error when doing a get or a search? Also, how are you
setting the value of 1 vs 999999999999999999? Is it done programatically
via the Java API or some other way? If retrieving via the api, it would be
interesting to see what
.getSource().get("store_id").getClass().getName()?

Derry

On Tuesday, 25 September 2012 09:31:18 UTC+1, Deepak Chezhian wrote:

Hi Derry,

The field type seems to be fine. PFB for the mapping.

"store_id" : { "type" : "long", "ignore_malformed" : false }

I am getting the following exception when i tried to access that field with value "1" using Java API term query

java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long

The long datatype is returned as excepted after updating that field in the same document with value "999999999999999999". Based on this, i suspect ES is returning the datatype(atlease incase of int/long) based on the value in the field.

Anyway of avoiding this?

Regards,

Deepak

On Tuesday, 25 September 2012 11:18:51 UTC+4, Derry O' Sullivan wrote:

HI Deepak,

I had a similar problem to this - what is the mapping according to the
index?
://_mapping

Check for the field you want and see what the mapping type is

I updated the mapping for my index to use a certain data type only and
then it seemed to return ok.
Elasticsearch Platform — Find real-time answers at scale | Elastic

Also, how are you checking that it returns an int vs long - class name
checking on the returned object?

Note, i'm a pretty new ES user!

Derry

On Tuesday, 25 September 2012 07:24:03 UTC+1, Deepak Chezhian wrote:

Hi,

I am querying the document which contains long field. If the long field
contains lesser values like 1, the java api returns integer object but if
the values are high like 999999999999999999, the java api returns long
object.

Is there anyway to consistently get the long object regardless of the
value of the field?

Regards,
Deepak

--

Hi Derry,

PFB.

Are you getting this error when doing a get or a search?
Search.

Also, how are you setting the value of 1 vs 999999999999999999?
1 is set programmatically using java api(indexing a document). 999999999999999999
is set using manually by using REST apis. I tried to set some integer
values with REST api but it is still coming as integer only, only when i
set values above the limit of the integer data type then long type is
returned.

*If retrieving via the api, it would be interesting to see what
.getSource().get("store_id").getClass().getName()? *

java.lang.Integer for value "1"
java.lang.Long for value "999999999999999999"

Regards,
Deepak

On Tuesday, 25 September 2012 12:49:55 UTC+4, Derry O' Sullivan wrote:

Hi Deepak,

I got the reverse problem (long to int) as i had loaded some content with
long like fields (ES guessed the type as long) and compared to the int
field values in another index. When i forced the data type to be int (by
deleting/reindexing the content), everything seemed to be fine.

Are you getting this error when doing a get or a search? Also, how are you
setting the value of 1 vs 999999999999999999? Is it done programatically
via the Java API or some other way? If retrieving via the api, it would be
interesting to see what
.getSource().get("store_id").getClass().getName()?

Derry

On Tuesday, 25 September 2012 09:31:18 UTC+1, Deepak Chezhian wrote:

Hi Derry,

The field type seems to be fine. PFB for the mapping.

"store_id" : { "type" : "long", "ignore_malformed" : false }

I am getting the following exception when i tried to access that field with value "1" using Java API term query

java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long

The long datatype is returned as excepted after updating that field in the same document with value "999999999999999999". Based on this, i suspect ES is returning the datatype(atlease incase of int/long) based on the value in the field.

Anyway of avoiding this?

Regards,

Deepak

On Tuesday, 25 September 2012 11:18:51 UTC+4, Derry O' Sullivan wrote:

HI Deepak,

I had a similar problem to this - what is the mapping according to the
index?
://_mapping

Check for the field you want and see what the mapping type is

I updated the mapping for my index to use a certain data type only and
then it seemed to return ok.
Elasticsearch Platform — Find real-time answers at scale | Elastic

Also, how are you checking that it returns an int vs long - class name
checking on the returned object?

Note, i'm a pretty new ES user!

Derry

On Tuesday, 25 September 2012 07:24:03 UTC+1, Deepak Chezhian wrote:

Hi,

I am querying the document which contains long field. If the long field
contains lesser values like 1, the java api returns integer object but if
the values are high like 999999999999999999, the java api returns long
object.

Is there anyway to consistently get the long object regardless of the
value of the field?

Regards,
Deepak

--

On 25 September 2012 11:26, Deepak Chezhian cdeepakcse@gmail.com wrote:

Hi Derry,

PFB.

Are you getting this error when doing a get or a search?
Search.

Also, how are you setting the value of 1 vs 999999999999999999?
1 is set programmatically using java api(indexing a document). 999999999999999999
is set using manually by using REST apis. I tried to set some integer
values with REST api but it is still coming as integer only, only when i
set values above the limit of the integer data type then long type is
returned.

Are you indexing 1 or 1L in java?

I suspect adding an L to the end of the number may solve the problem if
doing via the java api. If you don't specify that or have the number
cast/typed as a long in advance, it probably will add as an int. Surprising
that ES is not casting to the type specified on the mapping though...

*If retrieving via the api, it would be interesting to see what
.getSource().get("store_id").getClass().getName()? *

java.lang.Integer for value "1"
java.lang.Long for value "999999999999999999"

Regards,
Deepak

On Tuesday, 25 September 2012 12:49:55 UTC+4, Derry O' Sullivan wrote:

Hi Deepak,

I got the reverse problem (long to int) as i had loaded some content with
long like fields (ES guessed the type as long) and compared to the int
field values in another index. When i forced the data type to be int (by
deleting/reindexing the content), everything seemed to be fine.

Are you getting this error when doing a get or a search? Also, how are
you setting the value of 1 vs 999999999999999999? Is it done
programatically via the Java API or some other way? If retrieving via the
api, it would be interesting to see what .getSource().get("**
store_id").getClass().getName(**)?

Derry

On Tuesday, 25 September 2012 09:31:18 UTC+1, Deepak Chezhian wrote:

Hi Derry,

The field type seems to be fine. PFB for the mapping.

"store_id" : { "type" : "long", "ignore_malformed" : false }

I am getting the following exception when i tried to access that field with value "1" using Java API term query

java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long

The long datatype is returned as excepted after updating that field in the same document with value "999999999999999999". Based on this, i suspect ES is returning the datatype(atlease incase of int/long) based on the value in the field.

Anyway of avoiding this?

Regards,

Deepak

On Tuesday, 25 September 2012 11:18:51 UTC+4, Derry O' Sullivan wrote:

HI Deepak,

I had a similar problem to this - what is the mapping according to the
index?
://_**mapping

Check for the field you want and see what the mapping type is

I updated the mapping for my index to use a certain data type only and
then it seemed to return ok.
Elasticsearch Platform — Find real-time answers at scale | Elastic**
types.htmlhttp://www.elasticsearch.org/guide/reference/mapping/core-types.html

Also, how are you checking that it returns an int vs long - class name
checking on the returned object?

Note, i'm a pretty new ES user!

Derry

On Tuesday, 25 September 2012 07:24:03 UTC+1, Deepak Chezhian wrote:

Hi,

I am querying the document which contains long field. If the long
field contains lesser values like 1, the java api returns integer object
but if the values are high like 999999999999999999, the java api returns
long object.

Is there anyway to consistently get the long object regardless of the
value of the field?

Regards,
Deepak

--

--

Hi Derry,

I am taking the value Long object which is initialized as "1L" so there
might not be any problem with that, even i tried explicit conversion to
Long which setting the value to the field.

Regards,
Deepak

On Tuesday, 25 September 2012 14:30:17 UTC+4, Derry O' Sullivan wrote:

On 25 September 2012 11:26, Deepak Chezhian <cdeep...@gmail.com<javascript:>

wrote:

Hi Derry,

PFB.

Are you getting this error when doing a get or a search?
Search.

Also, how are you setting the value of 1 vs 999999999999999999?
1 is set programmatically using java api(indexing a document). 999999999999999999
is set using manually by using REST apis. I tried to set some integer
values with REST api but it is still coming as integer only, only when i
set values above the limit of the integer data type then long type is
returned.

Are you indexing 1 or 1L in java?

http://stackoverflow.com/questions/769963/javas-l-number-long-specification-question

I suspect adding an L to the end of the number may solve the problem if
doing via the java api. If you don't specify that or have the number
cast/typed as a long in advance, it probably will add as an int. Surprising
that ES is not casting to the type specified on the mapping though...

*If retrieving via the api, it would be interesting to see what
.getSource().get("store_id").getClass().getName()? *

java.lang.Integer for value "1"
java.lang.Long for value "999999999999999999"

Regards,
Deepak

On Tuesday, 25 September 2012 12:49:55 UTC+4, Derry O' Sullivan wrote:

Hi Deepak,

I got the reverse problem (long to int) as i had loaded some content
with long like fields (ES guessed the type as long) and compared to the int
field values in another index. When i forced the data type to be int (by
deleting/reindexing the content), everything seemed to be fine.

Are you getting this error when doing a get or a search? Also, how are
you setting the value of 1 vs 999999999999999999? Is it done
programatically via the Java API or some other way? If retrieving via the
api, it would be interesting to see what .getSource().get("**
store_id").getClass().getName(**)?

Derry

On Tuesday, 25 September 2012 09:31:18 UTC+1, Deepak Chezhian wrote:

Hi Derry,

The field type seems to be fine. PFB for the mapping.

"store_id" : { "type" : "long", "ignore_malformed" : false }

I am getting the following exception when i tried to access that field with value "1" using Java API term query

java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long

The long datatype is returned as excepted after updating that field in the same document with value "999999999999999999". Based on this, i suspect ES is returning the datatype(atlease incase of int/long) based on the value in the field.

Anyway of avoiding this?

Regards,

Deepak

On Tuesday, 25 September 2012 11:18:51 UTC+4, Derry O' Sullivan wrote:

HI Deepak,

I had a similar problem to this - what is the mapping according to the
index?
://_**mapping

Check for the field you want and see what the mapping type is

I updated the mapping for my index to use a certain data type only and
then it seemed to return ok.
Elasticsearch Platform — Find real-time answers at scale | Elastic**
types.htmlhttp://www.elasticsearch.org/guide/reference/mapping/core-types.html

Also, how are you checking that it returns an int vs long - class name
checking on the returned object?

Note, i'm a pretty new ES user!

Derry

On Tuesday, 25 September 2012 07:24:03 UTC+1, Deepak Chezhian wrote:

Hi,

I am querying the document which contains long field. If the long
field contains lesser values like 1, the java api returns integer object
but if the values are high like 999999999999999999, the java api returns
long object.

Is there anyway to consistently get the long object regardless of the
value of the field?

Regards,
Deepak

--

--

On 25 September 2012 11:37, Deepak Chezhian cdeepakcse@gmail.com wrote:

Hi Derry,

I am taking the value Long object which is initialized as "1L" so there
might not be any problem with that, even i tried explicit conversion to
Long which setting the value to the field.

Well i'm stumped then. Sounds like you are inserting a long into a field
that should be a long and getting back to int. Only think i can think of is
that ES is automatically setting the return type based on the value but i'm
unsure as to why it would do that over mappings....

Regards,

Deepak

On Tuesday, 25 September 2012 14:30:17 UTC+4, Derry O' Sullivan wrote:

On 25 September 2012 11:26, Deepak Chezhian cdeep...@gmail.com wrote:

Hi Derry,

PFB.

Are you getting this error when doing a get or a search?
Search.

Also, how are you setting the value of 1 vs 999999999999999999?
1 is set programmatically using java api(indexing a document). 999999999999999999
is set using manually by using REST apis. I tried to set some integer
values with REST api but it is still coming as integer only, only when i
set values above the limit of the integer data type then long type is
returned.

Are you indexing 1 or 1L in java?
http://stackoverflow.com/**questions/769963/javas-l-**
number-long-specification-**questionhttp://stackoverflow.com/questions/769963/javas-l-number-long-specification-question

I suspect adding an L to the end of the number may solve the problem if
doing via the java api. If you don't specify that or have the number
cast/typed as a long in advance, it probably will add as an int. Surprising
that ES is not casting to the type specified on the mapping though...

*If retrieving via the api, it would be interesting to see what
.getSource().get("store_id").getClass().getName()? *

java.lang.Integer for value "1"
java.lang.Long for value "999999999999999999"

Regards,
Deepak

On Tuesday, 25 September 2012 12:49:55 UTC+4, Derry O' Sullivan wrote:

Hi Deepak,

I got the reverse problem (long to int) as i had loaded some content
with long like fields (ES guessed the type as long) and compared to the int
field values in another index. When i forced the data type to be int (by
deleting/reindexing the content), everything seemed to be fine.

Are you getting this error when doing a get or a search? Also, how are
you setting the value of 1 vs 999999999999999999? Is it done
programatically via the Java API or some other way? If retrieving via the
api, it would be interesting to see what .getSource().get("*
*store_id").getClass().getName()**?

Derry

On Tuesday, 25 September 2012 09:31:18 UTC+1, Deepak Chezhian wrote:

Hi Derry,

The field type seems to be fine. PFB for the mapping.

"store_id" : { "type" : "long", "ignore_malformed" : false }

I am getting the following exception when i tried to access that field with value "1" using Java API term query

java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long

The long datatype is returned as excepted after updating that field in the same document with value "999999999999999999". Based on this, i suspect ES is returning the datatype(atlease incase of int/long) based on the value in the field.

Anyway of avoiding this?

Regards,

Deepak

On Tuesday, 25 September 2012 11:18:51 UTC+4, Derry O' Sullivan wrote:

HI Deepak,

I had a similar problem to this - what is the mapping according to
the index?
://_mapping

Check for the field you want and see what the mapping type is

I updated the mapping for my index to use a certain data type only
and then it seemed to return ok.
Elasticsearch Platform — Find real-time answers at scale | Elastic**
pes.htmlhttp://www.elasticsearch.org/guide/reference/mapping/core-types.html

Also, how are you checking that it returns an int vs long - class
name checking on the returned object?

Note, i'm a pretty new ES user!

Derry

On Tuesday, 25 September 2012 07:24:03 UTC+1, Deepak Chezhian wrote:

Hi,

I am querying the document which contains long field. If the long
field contains lesser values like 1, the java api returns integer object
but if the values are high like 999999999999999999, the java api returns
long object.

Is there anyway to consistently get the long object regardless of
the value of the field?

Regards,
Deepak

--

--

--

Looks like mappings are only used for ingestion:

According to the search docs:

Number Values

All REST APIs support providing numbered parameters as string on top of
supporting the native JSON number types.
I'm not sure how ES marshalls JSON but that may be where the problem is -
it's just returning the number based on the data.

On 25 September 2012 11:39, Derry O' Sullivan derryos@gmail.com wrote:

On 25 September 2012 11:37, Deepak Chezhian cdeepakcse@gmail.com wrote:

Hi Derry,

I am taking the value Long object which is initialized as "1L" so there
might not be any problem with that, even i tried explicit conversion to
Long which setting the value to the field.

Well i'm stumped then. Sounds like you are inserting a long into a field
that should be a long and getting back to int. Only think i can think of is
that ES is automatically setting the return type based on the value but i'm
unsure as to why it would do that over mappings....

Regards,

Deepak

On Tuesday, 25 September 2012 14:30:17 UTC+4, Derry O' Sullivan wrote:

On 25 September 2012 11:26, Deepak Chezhian cdeep...@gmail.com wrote:

Hi Derry,

PFB.

Are you getting this error when doing a get or a search?
Search.

Also, how are you setting the value of 1 vs 999999999999999999?
1 is set programmatically using java api(indexing a document). 999999999999999999
is set using manually by using REST apis. I tried to set some integer
values with REST api but it is still coming as integer only, only when i
set values above the limit of the integer data type then long type is
returned.

Are you indexing 1 or 1L in java?
http://stackoverflow.com/**questions/769963/javas-l-**
number-long-specification-**questionhttp://stackoverflow.com/questions/769963/javas-l-number-long-specification-question

I suspect adding an L to the end of the number may solve the problem if
doing via the java api. If you don't specify that or have the number
cast/typed as a long in advance, it probably will add as an int. Surprising
that ES is not casting to the type specified on the mapping though...

*If retrieving via the api, it would be interesting to see what
.getSource().get("store_id").getClass().getName()? *

java.lang.Integer for value "1"
java.lang.Long for value "999999999999999999"

Regards,
Deepak

On Tuesday, 25 September 2012 12:49:55 UTC+4, Derry O' Sullivan wrote:

Hi Deepak,

I got the reverse problem (long to int) as i had loaded some content
with long like fields (ES guessed the type as long) and compared to the int
field values in another index. When i forced the data type to be int (by
deleting/reindexing the content), everything seemed to be fine.

Are you getting this error when doing a get or a search? Also, how are
you setting the value of 1 vs 999999999999999999? Is it done
programatically via the Java API or some other way? If retrieving via the
api, it would be interesting to see what .getSource().get("
store_id").getClass().getName()?

Derry

On Tuesday, 25 September 2012 09:31:18 UTC+1, Deepak Chezhian wrote:

Hi Derry,

The field type seems to be fine. PFB for the mapping.

"store_id" : { "type" : "long", "ignore_malformed" : false }

I am getting the following exception when i tried to access that field with value "1" using Java API term query

java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long

The long datatype is returned as excepted after updating that field in the same document with value "999999999999999999". Based on this, i suspect ES is returning the datatype(atlease incase of int/long) based on the value in the field.

Anyway of avoiding this?

Regards,

Deepak

On Tuesday, 25 September 2012 11:18:51 UTC+4, Derry O' Sullivan wrote:

HI Deepak,

I had a similar problem to this - what is the mapping according to
the index?
://_mapping

Check for the field you want and see what the mapping type is

I updated the mapping for my index to use a certain data type only
and then it seemed to return ok.
Elasticsearch Platform — Find real-time answers at scale | Elastic**
pes.htmlhttp://www.elasticsearch.org/guide/reference/mapping/core-types.html

Also, how are you checking that it returns an int vs long - class
name checking on the returned object?

Note, i'm a pretty new ES user!

Derry

On Tuesday, 25 September 2012 07:24:03 UTC+1, Deepak Chezhian wrote:

Hi,

I am querying the document which contains long field. If the long
field contains lesser values like 1, the java api returns integer object
but if the values are high like 999999999999999999, the java api returns
long object.

Is there anyway to consistently get the long object regardless of
the value of the field?

Regards,
Deepak

--

--

--

For anyone else who encounters this issue, there is some discussion of what
causes this behaviour here:
https://groups.google.com/forum/#!searchin/elasticsearch/getsource$20integer$20long/elasticsearch/jxIY22TmA8U/PyqZPPyYQ0gJ

On Tuesday, 25 September 2012 11:51:43 UTC+1, Derry O' Sullivan wrote:

Looks like mappings are only used for ingestion:
Elasticsearch Platform — Find real-time answers at scale | Elastic

According to the search docs:
Elasticsearch Platform — Find real-time answers at scale | Elastic

Number Values

All REST APIs support providing numbered parameters as string on top of
supporting the native JSON number types.
I'm not sure how ES marshalls JSON but that may be where the problem is -
it's just returning the number based on the data.

On 25 September 2012 11:39, Derry O' Sullivan <der...@gmail.com<javascript:>

wrote:

On 25 September 2012 11:37, Deepak Chezhian <cdeep...@gmail.com<javascript:>

wrote:

Hi Derry,

I am taking the value Long object which is initialized as "1L" so there
might not be any problem with that, even i tried explicit conversion to
Long which setting the value to the field.

Well i'm stumped then. Sounds like you are inserting a long into a field
that should be a long and getting back to int. Only think i can think of is
that ES is automatically setting the return type based on the value but i'm
unsure as to why it would do that over mappings....

Regards,

Deepak

On Tuesday, 25 September 2012 14:30:17 UTC+4, Derry O' Sullivan wrote:

On 25 September 2012 11:26, Deepak Chezhian cdeep...@gmail.com wrote:

Hi Derry,

PFB.

Are you getting this error when doing a get or a search?
Search.

Also, how are you setting the value of 1 vs 999999999999999999?
1 is set programmatically using java api(indexing a document). 999999999999999999
is set using manually by using REST apis. I tried to set some integer
values with REST api but it is still coming as integer only, only when i
set values above the limit of the integer data type then long type is
returned.

Are you indexing 1 or 1L in java?
Java's L number (long) specification - Stack Overflow
number-long-specification-question

I suspect adding an L to the end of the number may solve the problem if
doing via the java api. If you don't specify that or have the number
cast/typed as a long in advance, it probably will add as an int. Surprising
that ES is not casting to the type specified on the mapping though...

*If retrieving via the api, it would be interesting to see what
.getSource().get("store_id").getClass().getName()? *

java.lang.Integer for value "1"
java.lang.Long for value "999999999999999999"

Regards,
Deepak

On Tuesday, 25 September 2012 12:49:55 UTC+4, Derry O' Sullivan wrote:

Hi Deepak,

I got the reverse problem (long to int) as i had loaded some content
with long like fields (ES guessed the type as long) and compared to the int
field values in another index. When i forced the data type to be int (by
deleting/reindexing the content), everything seemed to be fine.

Are you getting this error when doing a get or a search? Also, how
are you setting the value of 1 vs 999999999999999999? Is it done
programatically via the Java API or some other way? If retrieving via the
api, it would be interesting to see what .getSource().get("
store_id").getClass().getName()?

Derry

On Tuesday, 25 September 2012 09:31:18 UTC+1, Deepak Chezhian wrote:

Hi Derry,

The field type seems to be fine. PFB for the mapping.

"store_id" : { "type" : "long", "ignore_malformed" : false }

I am getting the following exception when i tried to access that field with value "1" using Java API term query

java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long

The long datatype is returned as excepted after updating that field in the same document with value "999999999999999999". Based on this, i suspect ES is returning the datatype(atlease incase of int/long) based on the value in the field.

Anyway of avoiding this?

Regards,

Deepak

On Tuesday, 25 September 2012 11:18:51 UTC+4, Derry O' Sullivan wrote:

HI Deepak,

I had a similar problem to this - what is the mapping according to
the index?
://_mapping

Check for the field you want and see what the mapping type is

I updated the mapping for my index to use a certain data type only
and then it seemed to return ok.
Elasticsearch Platform — Find real-time answers at scale | Elastic
pes.html

Also, how are you checking that it returns an int vs long - class
name checking on the returned object?

Note, i'm a pretty new ES user!

Derry

On Tuesday, 25 September 2012 07:24:03 UTC+1, Deepak Chezhian wrote:

Hi,

I am querying the document which contains long field. If the long
field contains lesser values like 1, the java api returns integer object
but if the values are high like 999999999999999999, the java api returns
long object.

Is there anyway to consistently get the long object regardless of
the value of the field?

Regards,
Deepak

--

--

--
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/9fd690f6-d3ae-4ba4-b973-a3dd2dc47565%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hi,
I'm also facing the same issue,
Did one managed to get solution for this problem ?
If yes please share solution thanks.

My mapping is

PUT test
{
"mappings": {
"testType": {
"properties": {
"TEST_ID": {
"type": "long",
"index": "not_analyzed"
}
}
}
}
}

Hi, is there any new solution?
I just find this problem in our project with es 5.1.1 version.
The problem is same, I have long fiend in mapping and JAVA API return Integer

Thanks for reply