# Does every index have its own shard?

**URL:** <https://discuss.elastic.co/t/does-every-index-have-its-own-shard/327526>\
**Category:** Elasticsearch\
**Created:** [March 13, 2023, 6:45am UTC](https://discuss.elastic.co/t/does-every-index-have-its-own-shard/327526 "2023-03-13T06:45:27Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![emrethedev](https://avatars.discourse-cdn.com/v4/letter/e/848f3c/32.png) [@emrethedev](https://discuss.elastic.co/u/emrethedev)\
**Post date:** [March 13, 2023, 6:45am UTC](https://discuss.elastic.co/t/does-every-index-have-its-own-shard/327526/1 "2023-03-13T06:45:27Z")

</div>

Hi,

(Sorry if this is a double post but i could not find answer.) Does every index have its own shard or may they have common shards? We know that when we create an index, it has 5 shards by default. So when we create an index, does elasticsearch create 5 shards or just assign 5 existing shards to the new index.

---

<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:** [March 13, 2023, 6:48am UTC](https://discuss.elastic.co/t/does-every-index-have-its-own-shard/327526/2 "2023-03-13T06:48:25Z")

</div>

Each index have its own shards. No shards are ever shared. If you have 5 shards generated by default I suspect you may be running a very old version that is EOL, so I would recommend upgrading.

---

<div class="post-metadata">

**Author:** ![emrethedev](https://avatars.discourse-cdn.com/v4/letter/e/848f3c/32.png) [@emrethedev](https://discuss.elastic.co/u/emrethedev)\
**Post date:** [March 13, 2023, 6:53am UTC](https://discuss.elastic.co/t/does-every-index-have-its-own-shard/327526/3 "2023-03-13T06:53:45Z")

</div>

Thanks for the reply Christian. I read the 5 shards info in [here](https://www.elastic.co/guide/en/elasticsearch/guide/master/_index_settings.html).

---

<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:** [March 13, 2023, 6:57am UTC](https://discuss.elastic.co/t/does-every-index-have-its-own-shard/327526/4 "2023-03-13T06:57:25Z")

</div>

That is from an old book that covers version 2 of Elasticsearch. Some information may still apply, but it is generally badly out of date. [It has since been changed](https://www.elastic.co/guide/en/elasticsearch/reference/8.6/index-modules.html#_static_index_settings).

---

<div class="post-metadata">

**Author:** ![emrethedev](https://avatars.discourse-cdn.com/v4/letter/e/848f3c/32.png) [@emrethedev](https://discuss.elastic.co/u/emrethedev)\
**Post date:** [March 13, 2023, 7:09am UTC](https://discuss.elastic.co/t/does-every-index-have-its-own-shard/327526/5 "2023-03-13T07:09:16Z")

</div>

Wow thanks for the enlightment. I could not find 8.6 version on Elasticsearch Guide search bar. I have another question. This is off topic but great issue. We have 10000 customers and we want to index their documents. We will create an index per customer and we want to scale elasticsearch if a customer uses it in large amount. How can we scale our product by per customer?

I have an idea like this =\> We use a unique alias per customer and assign these alias to their index names. If an index reaches large numbers, we create a new index with same alias and make the new index as write index in alias.

---

<div class="post-metadata">

**Author:** ![emrethedev](https://avatars.discourse-cdn.com/v4/letter/e/848f3c/32.png) [@emrethedev](https://discuss.elastic.co/u/emrethedev)\
**Post date:** [March 13, 2023, 8:24am UTC](https://discuss.elastic.co/t/does-every-index-have-its-own-shard/327526/6 "2023-03-13T08:24:02Z")

</div>

Christian i have one more question if you have time. Could you share a link with me about shards?( about "No shards are ever shared information") Thank you for your time.

---

<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:** [March 13, 2023, 8:46am UTC](https://discuss.elastic.co/t/does-every-index-have-its-own-shard/327526/7 "2023-03-13T08:46:39Z")

</div>

An index has one or more shards. That has been the case since the very first versions of Elasticsearch, so in that respect [the Definitive Guide](https://www.elastic.co/guide/en/elasticsearch/guide/current/distributed-cluster.html) is still correct. You can also find a descriptiion [in the current docs](https://www.elastic.co/guide/en/elasticsearch/reference/8.6/scalability.html#scalability).

---

<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:** [March 13, 2023, 8:48am UTC](https://discuss.elastic.co/t/does-every-index-have-its-own-shard/327526/8 "2023-03-13T08:48:44Z")

</div>

> [@emrethedev](#):
>
> Wow thanks for the enlightment. I could not find 8.6 version on Elasticsearch Guide search bar. I have another question. This is off topic but great issue. We have 10000 customers and we want to index their documents. We will create an index per customer and we want to scale elasticsearch if a customer uses it in large amount. How can we scale our product by per customer?

This way of handling multi-tenancy in Elasticsearch tend tio scale badly as indices and shards are not free and come with some overhead. This also applies to aliases.

If the customers all share the same schema I would recommend grouping users into indices rather than have dedicated indices per customer.

---

<div class="post-metadata">

**Author:** ![emrethedev](https://avatars.discourse-cdn.com/v4/letter/e/848f3c/32.png) [@emrethedev](https://discuss.elastic.co/u/emrethedev)\
**Post date:** [March 13, 2023, 9:03am UTC](https://discuss.elastic.co/t/does-every-index-have-its-own-shard/327526/9 "2023-03-13T09:03:51Z")

</div>

Customers share the same schema but according to data privacy and deleting data (if a customer cancels the membership) easily seems good fit for multi-tenancy. If a customer cancels the membership, we delete the index. I am not sure which one is more sensible (multi-tenancy or grouping)

---

<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:** [March 13, 2023, 9:11am UTC](https://discuss.elastic.co/t/does-every-index-have-its-own-shard/327526/10 "2023-03-13T09:11:14Z")

</div>

Having a large number of small indices and shards in Elasticsearch can be problematic and cause issues. There is a limit of 1000 shards per node in place to protect from this, although you can override it. The latest version of Elasticsearch handles large number of shards better than before, but I would probably still not recommend going with an index per customer unless the number of customers is quite low. If you have 10000 customers and want resiliency, you need a replica shard configured, which will result in 20000 shards.

If you are never going beyond 10000 customers you MAY make this work, but it will not scale well at all if you expect or hope the number of customers grows in the future.

---

<div class="post-metadata">

**Author:** ![emrethedev](https://avatars.discourse-cdn.com/v4/letter/e/848f3c/32.png) [@emrethedev](https://discuss.elastic.co/u/emrethedev)\
**Post date:** [March 13, 2023, 3:02pm UTC](https://discuss.elastic.co/t/does-every-index-have-its-own-shard/327526/11 "2023-03-13T15:02:47Z")

</div>

Actually 10000 is probably the top(there is no such customer right now) but we want to manage our product every scenario. But some customers may have very large datas, in this condition would not it be hard to delete the data of the customer that cancels the membership?

If we group our customers into indexes, will we add nodes into the cluster when our data will reach large numbers? (I assume that we should decide the shard number by considering that a shard shhould have between 10-50 GB)

Sorry if the questions are newbie, i research Elasticsearch just for two weeks.

---

<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:** [April 10, 2023, 3:03pm UTC](https://discuss.elastic.co/t/does-every-index-have-its-own-shard/327526/12 "2023-04-10T15:03:23Z")

</div>

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