# Effective separation of tenant data in latest release of ElasticSearch

**URL:** <https://discuss.elastic.co/t/effective-separation-of-tenant-data-in-latest-release-of-elasticsearch/156573>\
**Category:** Elasticsearch\
**Created:** [November 14, 2018, 3:18am UTC](https://discuss.elastic.co/t/effective-separation-of-tenant-data-in-latest-release-of-elasticsearch/156573 "2018-11-14T03:18:15Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rajesh\_Kishore](https://avatars.discourse-cdn.com/v4/letter/r/f05b48/32.png) [@Rajesh\_Kishore](https://discuss.elastic.co/u/Rajesh_Kishore)\
**Post date:** [November 14, 2018, 3:18am UTC](https://discuss.elastic.co/t/effective-separation-of-tenant-data-in-latest-release-of-elasticsearch/156573/1 "2018-11-14T03:18:15Z")

</div>

Hi All,

We want to use ElasticSearch as a multi-tenant store , each tenant would have different requirement for document type/schema.

What is the best way to store data wrt cost, manageability in this regard ?

1\> Each tenant having separate index with varying document types may not be efficient?

2\> A set of tenants may fall into one index with varying document types  
but With ElasticSearch's removal of mapping types mentioned in [link](https://www.elastic.co/guide/en/elasticsearch/reference/6.x/removal-of-types.html)  
It seems to be possible only through have custom type as mentioned in the link.

Please advise what is the best possible way to seperate tenant's data with each tenant having separate schema/document type requirement?

Thanks,  
Rajesh

---

<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:** [November 14, 2018, 4:30am UTC](https://discuss.elastic.co/t/effective-separation-of-tenant-data-in-latest-release-of-elasticsearch/156573/2 "2018-11-14T04:30:31Z")

</div>

> [@Rajesh\_Kishore](#):
>
> It seems to be possible only through have custom type as mentioned in the link.

That custom type is literally just a field and value, there's nothing special about it.

---

<div class="post-metadata">

**Author:** ![Rajesh\_Kishore](https://avatars.discourse-cdn.com/v4/letter/r/f05b48/32.png) [@Rajesh\_Kishore](https://discuss.elastic.co/u/Rajesh_Kishore)\
**Post date:** [November 14, 2018, 5:19am UTC](https://discuss.elastic.co/t/effective-separation-of-tenant-data-in-latest-release-of-elasticsearch/156573/3 "2018-11-14T05:19:40Z")

</div>

so could you pls advise what is the best strategy?

---

<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:** [November 14, 2018, 5:37am UTC](https://discuss.elastic.co/t/effective-separation-of-tenant-data-in-latest-release-of-elasticsearch/156573/4 "2018-11-14T05:37:21Z")

</div>

If you want to separate by customer then you will probably need to separate out documents that are not similar, perhaps you will need multiple indices per customer.  
If you want to group by document similarity then that would be ok, you just need to manage multi-tenancy with something like Security.

The best solution is one that works for you out of those, they both have pros and cons.

---

<div class="post-metadata">

**Author:** ![Rajesh\_Kishore](https://avatars.discourse-cdn.com/v4/letter/r/f05b48/32.png) [@Rajesh\_Kishore](https://discuss.elastic.co/u/Rajesh_Kishore)\
**Post date:** [November 14, 2018, 6:53am UTC](https://discuss.elastic.co/t/effective-separation-of-tenant-data-in-latest-release-of-elasticsearch/156573/5 "2018-11-14T06:53:05Z")

</div>

> [@warkolm](#):
>
> If you want to group by document similarity then that would be ok, you just need to manage multi-tenancy with something like Security.

But multiple indices per customer , wont affect performance ? and we wont have similar document type per tenant / or across tenant

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [November 14, 2018, 6:54am UTC](https://discuss.elastic.co/t/effective-separation-of-tenant-data-in-latest-release-of-elasticsearch/156573/6 "2018-11-14T06:54:44Z")

</div>

How many tenants are you expecting? How much control do you have over the data?

---

<div class="post-metadata">

**Author:** ![Rajesh\_Kishore](https://avatars.discourse-cdn.com/v4/letter/r/f05b48/32.png) [@Rajesh\_Kishore](https://discuss.elastic.co/u/Rajesh_Kishore)\
**Post date:** [November 14, 2018, 6:56am UTC](https://discuss.elastic.co/t/effective-separation-of-tenant-data-in-latest-release-of-elasticsearch/156573/7 "2018-11-14T06:56:23Z")

</div>

There can be many because initially we will have lot of free customers. Its not possible as of now to quantify how much as this is the cloud service we are building

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [November 14, 2018, 6:59am UTC](https://discuss.elastic.co/t/effective-separation-of-tenant-data-in-latest-release-of-elasticsearch/156573/8 "2018-11-14T06:59:40Z")

</div>

As mappings have to be consistent per index, you will need to impose some control on the content and mappings if you want tenants to shard indices. This is usually necessary as having an index per tenant scales badly. Having lots of small indices will result in performance problems.

There are no easy solutions, but I have seen users place controls on the data and have small users share indices and let a smaller number of larger users have their own.

I have seen users try going with one index per tenant and then deploy this across a lot of small clusters. This reduces the size of the cluster state per cluster but also does not necessarily scale well.

---

<div class="post-metadata">

**Author:** ![Rajesh\_Kishore](https://avatars.discourse-cdn.com/v4/letter/r/f05b48/32.png) [@Rajesh\_Kishore](https://discuss.elastic.co/u/Rajesh_Kishore)\
**Post date:** [November 14, 2018, 7:02am UTC](https://discuss.elastic.co/t/effective-separation-of-tenant-data-in-latest-release-of-elasticsearch/156573/9 "2018-11-14T07:02:00Z")

</div>

Got the idea to some extent, let me put more research on this , I will come back to this. In the meantime, more suggestions are highly appreciated.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [November 14, 2018, 7:02am UTC](https://discuss.elastic.co/t/effective-separation-of-tenant-data-in-latest-release-of-elasticsearch/156573/10 "2018-11-14T07:02:58Z")

</div>

This has been asked before, so you may find additional points if you search the forum.

---

<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:** [December 12, 2018, 7:02am UTC](https://discuss.elastic.co/t/effective-separation-of-tenant-data-in-latest-release-of-elasticsearch/156573/11 "2018-12-12T07:02:59Z")

</div>

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