# Fewer shards = less disk space used?

**URL:** <https://discuss.elastic.co/t/fewer-shards-less-disk-space-used/115287>\
**Category:** Elasticsearch\
**Created:** [January 12, 2018, 11:57am UTC](https://discuss.elastic.co/t/fewer-shards-less-disk-space-used/115287 "2018-01-12T11:57:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cosmo](https://avatars.discourse-cdn.com/v4/letter/c/46a35a/32.png) [@cosmo](https://discuss.elastic.co/u/cosmo)\
**Post date:** [January 12, 2018, 11:57am UTC](https://discuss.elastic.co/t/fewer-shards-less-disk-space-used/115287/1 "2018-01-12T11:57:45Z")

</div>

Hello

Hopefully a quick and easy question;  
Does having fewer shards per index equate to less disk space being used?

When I set off on my elastic adventure a year ago I used the default 5 shards per index. I now have 4 different index 'types'(?), each holding data for 30 days in a daily index, so that was quite a lot of shards for my poor little elastic box. (30 \* 4 \* 5), and it was taking about 30 minutes to restart as it was allocating all the shards!

I've changed the index template used to just use 1 shard per index now, and elastic seems to be much faster 😃  
As a side effect I have noticed in the xpack monitoring my Data value seems to have dropped. When I had 5 shards it was around 30GB, now I am around 25GB. (approx 60,000,000 documents, seems to be about what I usually have).

Is that what would be expected, or do I need to hunt around for where I have lost 5GB of data...

Thanks!

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 12, 2018, 1:44pm UTC](https://discuss.elastic.co/t/fewer-shards-less-disk-space-used/115287/2 "2018-01-12T13:44:18Z")

</div>

IMO it makes sense.

If we take as an example the inverted index, you have something which is like:

| term | doc id |
| --- | --- |
| a | 1,2,3 |
| b | 1,2,3,4,5 |

And you have that structure per shard. So in shard 0, you can have:

| term | doc id |
| --- | --- |
| a | 1 |
| b | 1 |

Shard1:

| term | doc id |
| --- | --- |
| a | 2 |
| b | 2 |

Shard2:

| term | doc id |
| --- | --- |
| a | 3 |
| b | 3 |

Shard3:

| term | doc id |
| --- | --- |
| b | 4 |

Shard4:

| term | doc id |
| --- | --- |
| b | 5 |

But with one single shard you have:

| term | doc id |
| --- | --- |
| a | 1,2,3 |
| b | 1,2,3,4,5 |

`a` and `b` are not duplicated 5 times anymore. adding to this that the doc\_id structure is highly optimized. Plus compression on store fields which is probably more efficient.

So I'd expect some gain.

My 0.05 cents

---

<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 9, 2018, 1:44pm UTC](https://discuss.elastic.co/t/fewer-shards-less-disk-space-used/115287/3 "2018-02-09T13:44:25Z")

</div>

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