# Make different routing key to isolated shard

**URL:** <https://discuss.elastic.co/t/make-different-routing-key-to-isolated-shard/67158>\
**Category:** Elasticsearch\
**Created:** [November 25, 2016, 6:40am UTC](https://discuss.elastic.co/t/make-different-routing-key-to-isolated-shard/67158 "2016-11-25T06:40:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![compasses](https://avatars.discourse-cdn.com/v4/letter/c/48db29/32.png) [@compasses](https://discuss.elastic.co/u/compasses)\
**Post date:** [November 25, 2016, 6:40am UTC](https://discuss.elastic.co/t/make-different-routing-key-to-isolated-shard/67158/1 "2016-11-25T06:40:00Z")

</div>

as we know the routing cannot make sure each shard have only one routing value. is there any way to make the routing key have one shard, means new routing key, new shard.

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [November 25, 2016, 9:42am UTC](https://discuss.elastic.co/t/make-different-routing-key-to-isolated-shard/67158/2 "2016-11-25T09:42:44Z")

</div>

If you want to have one tenant per shard, then routing is the wrong feature to look at. You could just have one index per tenant by using the routing key as an index name instead.

That said, I want to emphasize that you should try at keeping the total number of shards in your cluster reasonable, the optimal number being a couple per node. Why do you have this requirement to only have one tenant per shard?

---

<div class="post-metadata">

**Author:** ![compasses](https://avatars.discourse-cdn.com/v4/letter/c/48db29/32.png) [@compasses](https://discuss.elastic.co/u/compasses)\
**Post date:** [November 25, 2016, 11:01am UTC](https://discuss.elastic.co/t/make-different-routing-key-to-isolated-shard/67158/3 "2016-11-25T11:01:39Z")

</div>

Big thanks.  
sometimes we just want use the routing key to do search or filter, different routing means different customer.  
BTW, the optimal number shards per node should be 2 ? under what circumstances the shard number will effect the performance of ES? thanks

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [November 25, 2016, 11:04am UTC](https://discuss.elastic.co/t/make-different-routing-key-to-isolated-shard/67158/4 "2016-11-25T11:04:11Z")

</div>

You might want to look into filtered ad routed aliases then, which should make things both efficient and easier to manage.

The optimal number of shards is hard to tell, it depends on many factors really, but shards should be at least a few GB in size to amortize the constant overhead of shards, and probably less than something like 50GB to keep relocations of shards not too expensive.

---

<div class="post-metadata">

**Author:** ![compasses](https://avatars.discourse-cdn.com/v4/letter/c/48db29/32.png) [@compasses](https://discuss.elastic.co/u/compasses)\
**Post date:** [November 25, 2016, 11:19am UTC](https://discuss.elastic.co/t/make-different-routing-key-to-isolated-shard/67158/5 "2016-11-25T11:19:32Z")

</div>

great, big thanks.

---

<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:** [December 23, 2016, 11:20am UTC](https://discuss.elastic.co/t/make-different-routing-key-to-isolated-shard/67158/6 "2016-12-23T11:20:08Z")

</div>

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