# Routing in elastic search with range values

**URL:** <https://discuss.elastic.co/t/routing-in-elastic-search-with-range-values/12930>\
**Category:** Elasticsearch\
**Created:** [July 25, 2013, 6:29am UTC](https://discuss.elastic.co/t/routing-in-elastic-search-with-range-values/12930 "2013-07-25T06:29:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mahesh1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mahesh1/32/2311_2.png) [@Mahesh1](https://discuss.elastic.co/u/Mahesh1)\
**Post date:** [July 25, 2013, 6:29am UTC](https://discuss.elastic.co/t/routing-in-elastic-search-with-range-values/12930/1 "2013-07-25T06:29:03Z")

</div>

Hi

I want to index 30 days of data, in each day i will get GB's of data  
I Have 30 days of data, i have 10 shards, i want to route in such away ,  
that first 3 days of data should go to first shard, next 3 days of data  
should go to next shard ..etc

I am routing with date field, but i found data belongs to 1, 10,17 is going  
to 1 st 2, 11, .. going to next shard...etc .

Looking for u r response

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Philip](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/philip/32/2208_2.png) [@Philip](https://discuss.elastic.co/u/Philip)\
**Post date:** [July 25, 2013, 6:31am UTC](https://discuss.elastic.co/t/routing-in-elastic-search-with-range-values/12930/2 "2013-07-25T06:31:20Z")

</div>

On Wed, Jul 24, 2013 at 11:29 PM, Mahesh [via Elasticsearch Users]  
[ml-node+s115913n4038622h36@n3.nabble.com](mailto:ml-node+s115913n4038622h36@n3.nabble.com) wrote:

> Hi
> 
> I want to index 30 days of data, in each day i will get GB's of data  
> I Have 30 days of data, i have 10 shards, i want to route in such away ,  
> that first 3 days of data should go to first shard, next 3 days of data  
> should go to next shard ..etc

I would love to know why. What is your application?

Philip

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [July 25, 2013, 7:02am UTC](https://discuss.elastic.co/t/routing-in-elastic-search-with-range-values/12930/3 "2013-07-25T07:02:11Z")

</div>

Hey,

dont think in shards, but rather in indexes. For example, have one index  
per day and use aliases to group all indices for the data of one week or  
one month. The question is, why do you want to define what is going in  
which shard (or which index). Do you want to have faster queries? Do you  
want to to offload older data to weaker machines (a common scenario, which  
is possible with the allocation feature)? Maybe you can elaborate a bit  
there.

See:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/modules/cluster/) (See shard  
allocation)

Hope this helps for a start. If not, please explain your use case.

--Alex

On Thu, Jul 25, 2013 at 8:29 AM, Mahesh Parimi  
[mahesh.parimi1234@gmail.com](mailto:mahesh.parimi1234@gmail.com)wrote:

> Hi
> 
> I want to index 30 days of data, in each day i will get GB's of data  
> I Have 30 days of data, i have 10 shards, i want to route in such away ,  
> that first 3 days of data should go to first shard, next 3 days of data  
> should go to next shard ..etc
> 
> I am routing with date field, but i found data belongs to 1, 10,17 is  
> going to 1 st 2, 11, .. going to next shard...etc .
> 
> Looking for u r response
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Mahesh1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mahesh1/32/2311_2.png) [@Mahesh1](https://discuss.elastic.co/u/Mahesh1)\
**Post date:** [July 26, 2013, 5:27am UTC](https://discuss.elastic.co/t/routing-in-elastic-search-with-range-values/12930/4 "2013-07-26T05:27:49Z")

</div>

Thank you very Much,

The solutions you suggested are very closer to my problem, but I need  
something more. Here is my project requirement

Continuously my application receives data (TB), I have to index every  
file, and from the GUI I should display the data (matching data)

After 90 days I will delete the 1st day data, and store 91 data in it, for  
this I am using 11 machines, 1 is master 10 are slaves, so that, I can  
store first 10 days data in one shard, 10-20 days of data in another shard  
and so on, when user asks to display data between the dates, I can fire the  
query on specific shard using routing. Indexing, and searching is easy with  
this approach, but\* I am unable to route first 10 days of data in to one  
shard.\*

- 
  - 

_And also I need faster queries, because in 90 days data may be extended to  
300-400 TB_

- So I want to divide the data based on Date, so when a query is fired I ac  
search in 30 TB.\*

- Looking for your response\*

On Thursday, 25 July 2013 12:32:11 UTC+5:30, Alexander Reelsen wrote:

> Hey,
> 
> dont think in shards, but rather in indexes. For example, have one index  
> per day and use aliases to group all indices for the data of one week or  
> one month. The question is, why do you want to define what is going in  
> which shard (or which index). Do you want to have faster queries? Do you  
> want to to offload older data to weaker machines (a common scenario, which  
> is possible with the allocation feature)? Maybe you can elaborate a bit  
> there.
> 
> See:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases/)  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/modules/cluster/) (See shard  
> allocation)
> 
> Hope this helps for a start. If not, please explain your use case.
> 
> --Alex
> 
> On Thu, Jul 25, 2013 at 8:29 AM, Mahesh Parimi \<[mahesh.p...@gmail.com](mailto:mahesh.p...@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > Hi
> > 
> > I want to index 30 days of data, in each day i will get GB's of data  
> > I Have 30 days of data, i have 10 shards, i want to route in such away ,  
> > that first 3 days of data should go to first shard, next 3 days of data  
> > should go to next shard ..etc
> > 
> > I am routing with date field, but i found data belongs to 1, 10,17 is  
> > going to 1 st 2, 11, .. going to next shard...etc .
> > 
> > Looking for u r response
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:24am UTC](https://discuss.elastic.co/t/routing-in-elastic-search-with-range-values/12930/5 "2017-07-06T02:24:28Z")

</div>


