# Index size Reduced in Elasticsearch even When Number of Documents Increased

**URL:** <https://discuss.elastic.co/t/index-size-reduced-in-elasticsearch-even-when-number-of-documents-increased/244664>\
**Category:** Elasticsearch\
**Created:** [August 12, 2020, 6:51am UTC](https://discuss.elastic.co/t/index-size-reduced-in-elasticsearch-even-when-number-of-documents-increased/244664 "2020-08-12T06:51:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pulkit007](https://avatars.discourse-cdn.com/v4/letter/p/5e9695/32.png) [@pulkit007](https://discuss.elastic.co/u/pulkit007)\
**Post date:** [August 12, 2020, 6:51am UTC](https://discuss.elastic.co/t/index-size-reduced-in-elasticsearch-even-when-number-of-documents-increased/244664/1 "2020-08-12T06:51:45Z")

</div>

Hi There,

I am storing incremental data (Everyday 0.7 - 1 GB of data gets added) in Elasticsearch. The interesting observation I found is that :

The **index size in the elasticsearch decreased with time while the number of documents in that index increased with time**.

Index stat Yesterday :  
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size  
yellow open my\_index CFnG6rtNQAGDmI4zpGrFSb 5 1 85458039 83704 31.6gb 31.6gb

Index stat Today :  
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size  
yellow open my\_index CFnG6rtNQAGDmI4zpGrFSb 5 1 86428292 83704 27.5gb 27.5gb

As you can see the **number of docs** in the index **increased** from **85458039** to **86428292** (Increase of 970253 documents) while the **index size reduced** from **31.6gb** to **27.5gb**.

- How is that possible ?

- Am I loosing some data or is there some **compaction algorithm** working behind the scenes?

- I have specified **replica as 1** , so **why are store.size and pri.store.size same**?

- Why is my Index health is **Yellow**?

Please enlighten me.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 12, 2020, 8:55am UTC](https://discuss.elastic.co/t/index-size-reduced-in-elasticsearch-even-when-number-of-documents-increased/244664/2 "2020-08-12T08:55:48Z")

</div>

there is some compaction algorithm running the background. See [https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-merge.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-merge.html)

Your index health is yellow because you are very likely only running on a single node, but have configured this index to have a replica. Replicas are never put on the same node as a primary, so having a copy of a shard in single node cluster is not possible.

---

<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:** [September 9, 2020, 8:55am UTC](https://discuss.elastic.co/t/index-size-reduced-in-elasticsearch-even-when-number-of-documents-increased/244664/3 "2020-09-09T08:55:51Z")

</div>

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