# Dealing with geo\_point field type

**URL:** <https://discuss.elastic.co/t/dealing-with-geo-point-field-type/23297>\
**Category:** Elasticsearch\
**Created:** [April 17, 2015, 3:52pm UTC](https://discuss.elastic.co/t/dealing-with-geo-point-field-type/23297 "2015-04-17T15:52:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kaliseo](https://avatars.discourse-cdn.com/v4/letter/k/ce73a5/32.png) [@kaliseo](https://discuss.elastic.co/u/kaliseo)\
**Post date:** [April 17, 2015, 3:52pm UTC](https://discuss.elastic.co/t/dealing-with-geo-point-field-type/23297/1 "2015-04-17T15:52:09Z")

</div>

Hi There !

Got a little problem with geo\_point type.

I have lot of data with geo\_point informations indexed like this :  
"iplocation" : [  
{  
"ip" : "92.89.xx.xx",  
"location" : {  
"lat" : 48.86,  
"lon" : 2.35  
}  
}  
],

Here is my mapping :  
"iplocation" : {  
"properties" : {  
"ip" : {  
"index" : "not\_analyzed",  
"type" : "string",  
"doc\_values" : true  
},  
"location" : {  
"type" : "geo\_point"  
}  
}  
},

If i make a query on geo\_point, everything works fine.

I want to trace in map all points (with markers). I can not get the whole  
document, because they are too heavy. So i used the fields instruction. It  
seems not to work :  
{  
"query": {  
"bool": {  
"must": {  
"range": {  
"urls.date": {  
"gte": "now-1h"  
}  
}  
}  
}  
},  
"fields": [  
"iplocation.location."  
],  
"sort": [  
{  
"date": {  
"order": "desc"  
}  
}  
],  
"size": 100  
}

Gives me documents like this :  
{  
"\_index" : "myindex",  
"\_type" : "mytype",  
"\_id" : "AUzHkxQ9mTOfL8aT3Pgt",  
"\_score" : null,  
"sort" : [  
1429285738976  
]  
},

So i tried to use script fields :  
{  
"query": {  
"bool": {  
"must": {  
"range": {  
"urls.date": {  
"gte": "now-1h"  
}  
}  
}  
}  
},  
"script\_fields": {  
"geo": {  
"script": "doc['iplocation.location'].value"  
}  
},  
"sort": [  
{  
"date": {  
"order": "desc"  
}  
}  
],  
"size": 10000  
}

It worked, but for some shards, i obtain this error :  
RemoteTransportException[[Tarsal][inet[/5.196.81.111:9300]][indices:data/read/search[phase/fetch/id]]];  
nested: IOException[Can't write type [class  
org.elasticsearch.common.geo.GeoPoint]];

And i don't have all data in result.

Does someone have an idea of what i can do ?

Thanks a lot for your help !

Thierry

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/c30d57dc-6c89-4b0d-ba75-1b885d58811c%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c30d57dc-6c89-4b0d-ba75-1b885d58811c%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 12:19am UTC](https://discuss.elastic.co/t/dealing-with-geo-point-field-type/23297/2 "2017-07-06T00:19:00Z")

</div>


