# Elastic Index Allocation

**URL:** https://discuss.elastic.co/t/elastic-index-allocation/272222
**Category:** Elasticsearch
**Created:** [May 5, 2021, 8:25pm UTC](https://discuss.elastic.co/t/elastic-index-allocation/272222 "2021-05-05T20:25:03Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Abhishek\_Shinde](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@Abhishek\_Shinde](https://discuss.elastic.co/u/Abhishek_Shinde)
#### Post date: [May 5, 2021, 8:25pm UTC](https://discuss.elastic.co/t/elastic-index-allocation/272222/1 "2021-05-05T20:25:03Z")

</div>

We have typical deployment of 5000 users per server. We are planning to use Elasticsearch for indexing new data onwards. Our earlier indexing engine was having provision to map one index with one user. It was easier to restore single user index in case of any individual failures.

With Elasticsearch I see there is limitation of using 1000 shards per server. One Elasticsearch index could contain one more shards. Segment level allocation control is not available.

In either of the case, I need to map multiple users to single Elasticsearch Index. In case of any single user item failures, I may need to restore/repair entire Elasticsearch Index.

I wanted avoid unnessaray overriding of data for non impacted users In case of restore and repair.

Can anyone tell me best way to tackle this problem?

---

<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: [May 5, 2021, 8:58pm UTC](https://discuss.elastic.co/t/elastic-index-allocation/272222/2 "2021-05-05T20:58:41Z")

</div>

How much data does each user have? What is the total expected data volume?

---

<div class="post-metadata">

### Author: ![Abhishek\_Shinde](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@Abhishek\_Shinde](https://discuss.elastic.co/u/Abhishek_Shinde)
#### Post date: [May 6, 2021, 8:40am UTC](https://discuss.elastic.co/t/elastic-index-allocation/272222/3 "2021-05-06T08:40:36Z")

</div>

Typically, on an average 60k items per user.

As I mentioned above, there could be average 5k users per server.

---

<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: [May 6, 2021, 8:41am UTC](https://discuss.elastic.co/t/elastic-index-allocation/272222/4 "2021-05-06T08:41:37Z")

</div>

How are you exposing the data to the users? Custom UI?

---

<div class="post-metadata">

### Author: ![Abhishek\_Shinde](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@Abhishek\_Shinde](https://discuss.elastic.co/u/Abhishek_Shinde)
#### Post date: [May 6, 2021, 8:45am UTC](https://discuss.elastic.co/t/elastic-index-allocation/272222/5 "2021-05-06T08:45:10Z")

</div>

We have end user interface using Soap API.

---

<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: [May 6, 2021, 8:52am UTC](https://discuss.elastic.co/t/elastic-index-allocation/272222/6 "2021-05-06T08:52:06Z")

</div>

Then I would propose putting all users in a single index with a suitable number of primary shards. You can use routing to minimise the number of shards queried and add a user filter at the application layer to ensure each user sees the correct data. This will scale much better and be more efficient than an index per user. This does assume there are no mapping conflicts between users though.

---

<div class="post-metadata">

### Author: ![Abhishek\_Shinde](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@Abhishek\_Shinde](https://discuss.elastic.co/u/Abhishek_Shinde)
#### Post date: [May 7, 2021, 4:47am UTC](https://discuss.elastic.co/t/elastic-index-allocation/272222/8 "2021-05-07T04:47:15Z")

</div>

We are planning have a similar approach. Around 1000 users will map to a single Elasticsearch index contain 2 shards of 50 GB each.

To minimise the impact if any Index goes down, we are limiting the mapping to 1000 users. Let me know if you see any issues or any better approach here?

Secondly, the restore using snapshot works at index level. If there will be any issues with single user indexed items, then restoring an index would override other users item unnessasarily. Any idea how to overcome this problem?

---

<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: [May 7, 2021, 5:41am UTC](https://discuss.elastic.co/t/elastic-index-allocation/272222/9 "2021-05-07T05:41:54Z")

</div>

I do not see a need to limit it to 1000 users per index. It just adds a step of identifying the correct index for the user without much benefit. If you use routing you can also speed up searching by having a reasonably large number, e.g. 100, primary shards if you use routing.

Restoring an index will indeed affect all users. You can however restore an index under a different name and delete and reindex data for a specific user as they have relatively little data.

---

<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 6, 2021, 2:44am UTC](https://discuss.elastic.co/t/elastic-index-allocation/272222/11 "2021-06-06T02:44:49Z")

</div>

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