# Sharding of geo\_points

**URL:** <https://discuss.elastic.co/t/sharding-of-geo-points/27284>\
**Category:** Elasticsearch\
**Created:** [August 12, 2015, 7:03pm UTC](https://discuss.elastic.co/t/sharding-of-geo-points/27284 "2015-08-12T19:03:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![belaboros](https://avatars.discourse-cdn.com/v4/letter/b/c68b51/32.png) [@belaboros](https://discuss.elastic.co/u/belaboros)\
**Post date:** [August 12, 2015, 7:03pm UTC](https://discuss.elastic.co/t/sharding-of-geo-points/27284/1 "2015-08-12T19:03:51Z")

</div>

Please help me,  
I cannot make sharding on geo\_point work.  
I would like to store one value and a geo location (latitude and longitude) in a document.  
I would like to populate shards (route) based on location.

Then I would like to query the the average value of the 50 closest location.

My mappings:  
{  
"mappings" : {  
"DocType" : {  
"\_source" : { "enabled" : true },  
"\_all" : { "enabled" : true},  
"\_routing" : {  
"required" : true,  
"path" : "location"  
},  
"properties" : {  
"location" : { "type":"geo\_point", "lat\_lon":true, "geohash":true, "geohash\_prefix":true, "geohash\_precision": "50km" },  
"value" : { "type":"float" , "index":"not\_analyzed" },  
}  
}  
}  
}

Settings for 10 shards and 0 replicas:  
{  
"number\_of\_shards" : 10,  
"number\_of\_replicas" : 0  
}

But all my documents with various lat and lon coordiantes are inserted into one shard.

Please help me what I have missed in the documentation.  
Can I shard based on a geo-point field somehow.

The default sharding is not good for me, because the documents are scattered over the 10 shards and each node is overloaded.

Thanks,  
Béla

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [August 12, 2015, 10:32pm UTC](https://discuss.elastic.co/t/sharding-of-geo-points/27284/2 "2015-08-12T22:32:15Z")

</div>

When you route it needs to be on a value, it can't be on an array like that.  
You could use a [geohash](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-geo-point-type.html#_geohashes) instead.

---

<div class="post-metadata">

**Author:** ![belaboros](https://avatars.discourse-cdn.com/v4/letter/b/c68b51/32.png) [@belaboros](https://discuss.elastic.co/u/belaboros)\
**Post date:** [August 13, 2015, 8:02am UTC](https://discuss.elastic.co/t/sharding-of-geo-points/27284/3 "2015-08-13T08:02:54Z")

</div>

Thanks for pointing out the direction.

Is there a small working sample available?  
(Mapping and efficient location based query that uses the geohash based routing)

Thanks,  
Béla

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [August 13, 2015, 8:24am UTC](https://discuss.elastic.co/t/sharding-of-geo-points/27284/4 "2015-08-13T08:24:46Z")

</div>

Nope, I haven't seen anyone do this so I'd be interested to see your outcome.

---

<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 5, 2017, 11:56pm UTC](https://discuss.elastic.co/t/sharding-of-geo-points/27284/5 "2017-07-05T23:56:02Z")

</div>


