# Multi-Tenancy and Indexes / Aliases / Routing

**URL:** <https://discuss.elastic.co/t/multi-tenancy-and-indexes-aliases-routing/260655>\
**Category:** Elasticsearch\
**Created:** [January 10, 2021, 6:16pm UTC](https://discuss.elastic.co/t/multi-tenancy-and-indexes-aliases-routing/260655 "2021-01-10T18:16:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nickdb93](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickdb93/32/81992_2.png) [@nickdb93](https://discuss.elastic.co/u/nickdb93)\
**Post date:** [January 10, 2021, 6:16pm UTC](https://discuss.elastic.co/t/multi-tenancy-and-indexes-aliases-routing/260655/1 "2021-01-10T18:16:31Z")

</div>

I know that how one deals with multi-tenancy is really based on use-case, but I just cannot seem to figure out the best approach to take, even after [reading](https://www.elastic.co/blog/found-multi-tenancy) some examples.

My use case is as such.

- `Organizations` are tenants with many `users`
- `Organizations` own "datasets"
- `Datasets` consist of documents containing fields of data parsed from raw files (such as text files, videos, PDFs, and many more)
- `Projects` consist of many `datasets` and many `users` have access to these `projects`
  - `Datasets` can belong to multiple `Projects`, not just to one

- `Users` within an `Organization` can have access to multiple `Projects`
  - and thus, the `datasets` that belong to them, or even `datasets` that do not yet belong to a `project`.

My thought is that I would like to be able to search specific `datasets`.

- If user searches a `project`, search will take place across all `datasets` that belong to that project
- If user searches a `dataset` search will only take place across that single `dataset`

My first instinct, of course, is to create one index per `dataset`, but after reading around I know that might not be a very smart decision. Some datasets may be very large and complex, while others may be small. On top of that, there will be a _lot_ of datasets.

My next instinct is to use `routing`, but I still have the same problem: what should I use as the index? `Organization` may be too large (and there may be tens of thousands of them), and `datasets` may be too numerous (there may be tens of thousands per `organization`).

---

<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:** [February 7, 2021, 6:16pm UTC](https://discuss.elastic.co/t/multi-tenancy-and-indexes-aliases-routing/260655/2 "2021-02-07T18:16:41Z")

</div>

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