Geo_point mapped field is returned as string in java api

has anyone seen this problem? my mapping says that the field is of type
geo_point. but when i read documents using java api and get the sourcemap,
the type of the field is string and i can't cast it to a GeoPoint.

...
"lat_lng" : {
"type" : "geo_point",
"lat_lon" : true
},
..

thanks

--
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/CAHau4ysRanZ%3DsO8zKJjDDx4tpSnG1zcXnXhHB4cfnbOyQkvXoQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Can you post a code example from your use case for how you're inserting,
retrieving, and reading the documents?

  • Nick

On Tuesday, December 2, 2014 2:16:30 PM UTC-6, T Vinod Gupta wrote:

has anyone seen this problem? my mapping says that the field is of type
geo_point. but when i read documents using java api and get the sourcemap,
the type of the field is string and i can't cast it to a GeoPoint.

...
"lat_lng" : {
"type" : "geo_point",
"lat_lon" : true
},
..

thanks

--
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/b5ed03a4-eaad-491b-9856-087ae3ab2587%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

nevermind, i solved it by doing something like this -
GeoPoint latLng = GeoPoint.parseFromLatLon((String)
sourceMap.get("lat_lng"));

at the time of indexing, i am passing as ","

earlier i was passing as GeoPoint but that caused a major problem and
messed up my mapping. When i read the document and then change some other
field and do index, then it would raise this exception -
ElasticsearchParseException("field must be either '" + LATITUDE + "', '" +
LONGITUDE + "' or '" + GEOHASH + "'");

so i figured that indexing by passing the string (even though mapping is
geo_point) works.
thanks

On Thu, Dec 4, 2014 at 6:32 AM, Nicholas Knize <
nicholas.knize@elasticsearch.com> wrote:

Can you post a code example from your use case for how you're inserting,
retrieving, and reading the documents?

  • Nick

On Tuesday, December 2, 2014 2:16:30 PM UTC-6, T Vinod Gupta wrote:

has anyone seen this problem? my mapping says that the field is of type
geo_point. but when i read documents using java api and get the sourcemap,
the type of the field is string and i can't cast it to a GeoPoint.

...
"lat_lng" : {
"type" : "geo_point",
"lat_lon" : true
},
..

thanks

--
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/b5ed03a4-eaad-491b-9856-087ae3ab2587%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/b5ed03a4-eaad-491b-9856-087ae3ab2587%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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/CAHau4yvDyp5uO_bhj%3DFwNtNB_fPu9sHpbKfb-OMr4hBygL8bfQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Glad to hear you resolved your issue. Let us know if you have any other
questions.

  • Nick

On Thursday, December 4, 2014 12:04:14 PM UTC-6, T Vinod Gupta wrote:

nevermind, i solved it by doing something like this -
GeoPoint latLng = GeoPoint.parseFromLatLon((String)
sourceMap.get("lat_lng"));

at the time of indexing, i am passing as ","

earlier i was passing as GeoPoint but that caused a major problem and
messed up my mapping. When i read the document and then change some other
field and do index, then it would raise this exception -
ElasticsearchParseException("field must be either '" + LATITUDE + "', '" +
LONGITUDE + "' or '" + GEOHASH + "'");

so i figured that indexing by passing the string (even though mapping is
geo_point) works.
thanks

On Thu, Dec 4, 2014 at 6:32 AM, Nicholas Knize <
nichola...@elasticsearch.com <javascript:>> wrote:

Can you post a code example from your use case for how you're inserting,
retrieving, and reading the documents?

  • Nick

On Tuesday, December 2, 2014 2:16:30 PM UTC-6, T Vinod Gupta wrote:

has anyone seen this problem? my mapping says that the field is of type
geo_point. but when i read documents using java api and get the sourcemap,
the type of the field is string and i can't cast it to a GeoPoint.

...
"lat_lng" : {
"type" : "geo_point",
"lat_lon" : true
},
..

thanks

--
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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/b5ed03a4-eaad-491b-9856-087ae3ab2587%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/b5ed03a4-eaad-491b-9856-087ae3ab2587%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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/138a1355-7815-4afa-915d-924332ce494a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.