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?
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?
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
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?
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.
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
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?
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.
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
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?
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.
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
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?
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.
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.
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
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?
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:
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.
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.
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
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?
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:
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:
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.
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.
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
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?
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:
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.
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.
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
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?
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
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.