# Removing \_source increases size of index

**URL:** <https://discuss.elastic.co/t/removing-source-increases-size-of-index/283699>\
**Category:** Elasticsearch\
**Created:** [September 8, 2021, 5:11pm UTC](https://discuss.elastic.co/t/removing-source-increases-size-of-index/283699 "2021-09-08T17:11:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dan\_Christensen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dan_christensen/32/94328_2.png) [@Dan\_Christensen](https://discuss.elastic.co/u/Dan_Christensen)\
**Post date:** [September 8, 2021, 5:11pm UTC](https://discuss.elastic.co/t/removing-source-increases-size-of-index/283699/1 "2021-09-08T17:11:25Z")

</div>

I've been trying to find ways to optimize my index size in Elasticsearch. In order to understand the size impact of the \_source field, I dumped an index and re-indexed into another index with \_source {enabled:false}. The original index was 466.9mb. I was somewhat shocked when the index with \_source disabled actually resulted in an index size of 467.1mb... a slight _increase_ in size. How is this possible?

I verified that the index/\_mappings show \_source disabled, my search results don't include \_source and when I try to ask for \_source=somefield, I get an error message. So, I'm fairly certain that the \_source is actually removed in my test index.

I'm not sure that I actually want to remove \_source in my production environment, but I'd really like to understand the storage optimizations that make it possible to store \_source without adding additional size to the index.

---

<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:** [September 8, 2021, 11:42pm UTC](https://discuss.elastic.co/t/removing-source-increases-size-of-index/283699/2 "2021-09-08T23:42:50Z")

</div>

Welcome to our community! 😃

I wouldn't remove source, it's something that I think it going to be deprecated in future as it severely limits other functionality, so you're likely on the backfoot if you do this. (See related warning here - [\_source field | Elasticsearch Guide [7.14] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-source-field.html#include-exclude.))

It'd help if you shared the mappings, and sample docs, so we can take a closer look.

---

<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:** [September 9, 2021, 1:58am UTC](https://discuss.elastic.co/t/removing-source-increases-size-of-index/283699/3 "2021-09-09T01:58:21Z")

</div>

Unless you forcemerged down to a single segment the two indices can be in different stages of merging which can affect size significantly.

I would also recommend verifying that mappings have not changed.

---

<div class="post-metadata">

**Author:** ![Dan\_Christensen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dan_christensen/32/94328_2.png) [@Dan\_Christensen](https://discuss.elastic.co/u/Dan_Christensen)\
**Post date:** [September 9, 2021, 10:06pm UTC](https://discuss.elastic.co/t/removing-source-increases-size-of-index/283699/4 "2021-09-09T22:06:00Z")

</div>

Thanks, I wasn't planning on removing \_source, but wanted to understand the impact that it had on index size. I found my answer in this issue: [https://github.com/elastic/elasticsearch/issues/41628#issuecomment-488155381](https://github.com/elastic/elasticsearch/issues/41628#issuecomment-488155381). If source is disabled and soft deletes are enabled, then elastic will automatically stuff the source into a stored field called \_recovery\_source. This makes it appear that disabling source does not reduce the size of the index since soft deletes are enabled by default.

---

<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:** [October 7, 2021, 10:06pm UTC](https://discuss.elastic.co/t/removing-source-increases-size-of-index/283699/5 "2021-10-07T22:06:49Z")

</div>

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