# Geo\_point field problems

**URL:** <https://discuss.elastic.co/t/geo-point-field-problems/78301>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [March 13, 2017, 2:46am UTC](https://discuss.elastic.co/t/geo-point-field-problems/78301 "2017-03-13T02:46:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![1222kkk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/1222kkk/32/23635_2.png) [@1222kkk](https://discuss.elastic.co/u/1222kkk)\
**Post date:** [March 13, 2017, 2:46am UTC](https://discuss.elastic.co/t/geo-point-field-problems/78301/1 "2017-03-13T02:46:12Z")

</div>

mapping just as following:

```
 "properties": {
           "BH": {
              "type": "string"
           },
           "GD": {
              "type": "long"
           },
           "GJ": {
              "type": "string"
           },
           "GPS": {
              "type": "geo_point"
           },
           "HX": {
              "type": "double"
           },
           "MC": {
              "type": "string"
           },
           "MC2": {
              "type": "string"
           },
           "MC3": {
              "type": "string"
           },
           "MC4": {
              "type": "string"
           },
           "SJ": {
              "type": "date",
              "format": "yyyy/MM/dd HH:mm:ss||yyyy/MM/dd||epoch_millis"
           }
        }

```

the test data :

```
{
       "GPS":{
              "lat":21.22222,
              "lon":22.111111        
        }
}

```

Then use es-hadoop to cache data to Spark

if the mount of data is below 10,000, all works well.  
While cache more data, Spark throw the following errors:

```
    17/03/07 11:18:52 ERROR Executor: Exception in task 30.0 in stage 19.0 (TID 166)
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Double
        at scala.runtime.BoxesRunTime.unboxToDouble(BoxesRunTime.java:114)
        at org.apache.spark.sql.catalyst.expressions.BaseGenericInternalRow$class.getDouble(rows.scala:44)
        at org.apache.spark.sql.catalyst.expressions.GenericInternalRow.getDouble(rows.scala:221)
        at

```

Then I tried to update all gps fields, with array format:

```
{
      "GPS":[
              21.22222,
              22.111111        
        ]
}

```

Well, all success. Although Spark cache geo\_point as array type.

Above all, I just wonder what's the correct way to cache geo\_point type fields in Spark to avoid type error? 🙂

language: scala  
es version: 2.3.2  
es-hadoop version: 5.1  
spark version:2.0.2

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![1222kkk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/1222kkk/32/23635_2.png) [@1222kkk](https://discuss.elastic.co/u/1222kkk)\
**Post date:** [March 15, 2017, 1:24am UTC](https://discuss.elastic.co/t/geo-point-field-problems/78301/2 "2017-03-15T01:24:02Z")

</div>

hi ！ @james.baiera

I wish you can give me some advice about the topic.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 12, 2017, 1:24am UTC](https://discuss.elastic.co/t/geo-point-field-problems/78301/3 "2017-04-12T01:24:34Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
