# Routing: Equal distribution on all shards

**URL:** <https://discuss.elastic.co/t/routing-equal-distribution-on-all-shards/183531>\
**Category:** Elasticsearch\
**Created:** [May 30, 2019, 1:01pm UTC](https://discuss.elastic.co/t/routing-equal-distribution-on-all-shards/183531 "2019-05-30T13:01:42Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![pokaleshrey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pokaleshrey/32/48680_2.png) [@pokaleshrey](https://discuss.elastic.co/u/pokaleshrey)\
**Post date:** [May 31, 2019, 4:15am UTC](https://discuss.elastic.co/t/routing-equal-distribution-on-all-shards/183531/3 "2019-05-31T04:15:14Z")

</div>

Thanks for your reply.

I am not using the default routing, while indexing i do specify eg: routing=a.

My problem is when i finish indexing for all routing keys i have. Shard 1 remains unallocated.  
I need a way such that a,b,c,d,e, (having 5 shards in ES), documents for each routing key goes on separate shard.

I understand that it totally depends on the hash generate for the given keys.

**My base problem:**  
In above example say routing=a and routing=e goes on same shard i.e. 4.  
Assume a and e are types of documents, which have few fields in common. When i query documents with routing=a and on common fields, ES also checks all documents in routing=e lowering the performance extensively.  
[Check this thread](https://discuss.elastic.co/t/structured-hierarchy-repeating-fields-causing-low-performance/182482)

_Some issue which i see with shard allocation by routing_  
If i have 50shards and have 100 routing keys, it may happen that due to the nature of hash generated, some shards will remain unallocated for ever.

_Suggestion_:  
There could be a routing key to shard number mapping in the settings section which will give this control to the user. Such that user will decide which shard the routing key maps to.

---

_[View the full topic](https://discuss.elastic.co/t/routing-equal-distribution-on-all-shards/183531)._
