# Index lifecycle for multi-tenant app with different tiers

**URL:** <https://discuss.elastic.co/t/index-lifecycle-for-multi-tenant-app-with-different-tiers/234087>\
**Category:** Elasticsearch\
**Created:** [May 25, 2020, 7:04am UTC](https://discuss.elastic.co/t/index-lifecycle-for-multi-tenant-app-with-different-tiers/234087 "2020-05-25T07:04:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yannis\_Psarras](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yannis_psarras/32/68945_2.png) [@Yannis\_Psarras](https://discuss.elastic.co/u/Yannis_Psarras)\
**Post date:** [May 25, 2020, 7:04am UTC](https://discuss.elastic.co/t/index-lifecycle-for-multi-tenant-app-with-different-tiers/234087/1 "2020-05-25T07:04:23Z")

</div>

Hi team!

Got a question that I ve been thinking about for the past couple of days but can't come up with an elegant solution.

We have a multi-tenant app. Many users are accessing a cloud software. Different users have different pricing tiers: free, pro, enterprise. Different tiers have different data retention, e.g. free = 14 days, pro = 30 days, enterprise = 60 days. Numbers and examples are all made up.

I would like to be able to introduce this logic as part of our index lifecycle . I was thinking that I introduce the tier as part of the index name. (e.g. rawdata-free, rawdata-pro etc.) I assume this will work fine but someone may jump tiers by purchasing, upgrading, downgrading etc.

The next - not so elegant solution - is to do this manually. Use the delete by query api and delete documents conditionally within the index. Not great as there will be TBs of data in a month (and not on the same index)

Anything else I should be using?

---

<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:** [May 26, 2020, 12:47am UTC](https://discuss.elastic.co/t/index-lifecycle-for-multi-tenant-app-with-different-tiers/234087/2 "2020-05-26T00:47:08Z")

</div>

It should work, yes.  
You would need to work out the complexities of changes in levels yourself though.

---

<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:** [June 23, 2020, 12:47am UTC](https://discuss.elastic.co/t/index-lifecycle-for-multi-tenant-app-with-different-tiers/234087/3 "2020-06-23T00:47:10Z")

</div>

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