# Does "routing" always improve performance?

**URL:** <https://discuss.elastic.co/t/does-routing-always-improve-performance/9611>\
**Category:** Elasticsearch\
**Created:** [November 7, 2012, 11:22pm UTC](https://discuss.elastic.co/t/does-routing-always-improve-performance/9611 "2012-11-07T23:22:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![T\_Vinod\_Gupta](https://avatars.discourse-cdn.com/v4/letter/t/fbc32d/32.png) [@T\_Vinod\_Gupta](https://discuss.elastic.co/u/T_Vinod_Gupta)\
**Post date:** [November 7, 2012, 11:22pm UTC](https://discuss.elastic.co/t/does-routing-always-improve-performance/9611/1 "2012-11-07T23:22:08Z")

</div>

im trying to explore how to increase my query speeds and in light of that,  
i was going through all the routing related discussions..

1. does routing always improve query speed? if i have 2 nodes (1 replica)  
with 5 shards on an index and if i use routing, will it have a big impact?  
wont it lead to shard hotspotting become counter productive? as in some set  
of documents that have the same routing key have a high indexing rate  
(and/or querying rate) and can have a negative impact?

2. if i have hundreds of thousands of existing documents that i want to add  
a routing key to, then do i have to reindex them with a routing key?

thanks

--

---

<div class="post-metadata">

**Author:** ![radu\_gheorghe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/radu_gheorghe/32/556_2.png) [@radu\_gheorghe](https://discuss.elastic.co/u/radu_gheorghe)\
**Post date:** [November 8, 2012, 10:17am UTC](https://discuss.elastic.co/t/does-routing-always-improve-performance/9611/2 "2012-11-08T10:17:20Z")

</div>

Hello,

On Thu, Nov 8, 2012 at 1:22 AM, T Vinod Gupta [tvinod@readypulse.com](mailto:tvinod@readypulse.com) wrote:

> im trying to explore how to increase my query speeds and in light of that, i  
> was going through all the routing related discussions..
> 
> 1. does routing always improve query speed? if i have 2 nodes (1 replica)  
> with 5 shards on an index and if i use routing, will it have a big impact?

I guess there's no getting away from testing, since it will also  
depend on how your queries look like, but I suspect not.

> wont it lead to shard hotspotting become counter productive? as in some set  
> of documents that have the same routing key have a high indexing rate  
> (and/or querying rate) and can have a negative impact?

You might run into this sort of issues if you choose an inappropriate  
shard key. For example, a timestamp of a log message wouldn't be a  
good candidate, since you'll always insert on the same shard, and  
you're most likely to only query it as well.

But there are usecases where it helps. For example, if you have a  
blogging site where users have a relatively balanced number of posts.  
Then you can put the username as a routing value, which will make  
filtering by user or searching posts of specific users really fast.

Take a look at this presentation, where you'll also get some  
performance numbers on that particular scenario:

> **[Elastic — The Search AI Company](https://www.elastic.co)**
>
> Power insights and outcomes with The Elastic Search AI Platform. See into your data and find answers that matter with enterprise solutions designed to help you accelerate time to insight. Try Elastic ...

> 1. if i have hundreds of thousands of existing documents that i want to add  
> a routing key to, then do i have to reindex them with a routing key?

Yes, as far as I know, you'll have to reindex.

## Best regards, Radu

[http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene

--

---

<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, 3:05am UTC](https://discuss.elastic.co/t/does-routing-always-improve-performance/9611/3 "2017-07-06T03:05:27Z")

</div>


