# Monthly rolling index with custom routing

**URL:** <https://discuss.elastic.co/t/monthly-rolling-index-with-custom-routing/315706>\
**Category:** Elasticsearch\
**Created:** [October 3, 2022, 4:52pm UTC](https://discuss.elastic.co/t/monthly-rolling-index-with-custom-routing/315706 "2022-10-03T16:52:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![PV2000](https://avatars.discourse-cdn.com/v4/letter/p/3d9bf3/32.png) [@PV2000](https://discuss.elastic.co/u/PV2000)\
**Post date:** [October 3, 2022, 4:52pm UTC](https://discuss.elastic.co/t/monthly-rolling-index-with-custom-routing/315706/1 "2022-10-03T16:52:52Z")

</div>

Hi,  
I am trying to figure out the how to create a monthly rolling index with custom routing (multi-tenancy scenario) , with these requirements :

- WRITE flow : Each document will have a timestamp and the document should be indexed to the appropriate backing index based on that timestamp and not to the latest index. Also, write requests will have a custom routing key (eg: customerId) so they hit a specific shard.
- READ flow : Requests must be routed to all backing indexes. Requests will have a custom routing key specified (eg: customerId) and results must be aggregated and returned.
- Index creation : Rolling the index should be automated. Each index should have a custom routing key (eg: customerId )

Wondering, what are the options available ?

---

<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:** [October 4, 2022, 5:02am UTC](https://discuss.elastic.co/t/monthly-rolling-index-with-custom-routing/315706/2 "2022-10-04T05:02:55Z")

</div>

Welcome to our community! 😃

Given your first condition, you will need to handle this all yourself using time based indices and curator (or similar).

---

<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:** [November 1, 2022, 5:03am UTC](https://discuss.elastic.co/t/monthly-rolling-index-with-custom-routing/315706/3 "2022-11-01T05:03:26Z")

</div>

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