# Delete huge field from index

**URL:** <https://discuss.elastic.co/t/delete-huge-field-from-index/378784>\
**Category:** Elastic Search\
**Created:** [June 2, 2025, 8:12am UTC](https://discuss.elastic.co/t/delete-huge-field-from-index/378784 "2025-06-02T08:12:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ALIT](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@ALIT](https://discuss.elastic.co/u/ALIT)\
**Post date:** [June 2, 2025, 8:12am UTC](https://discuss.elastic.co/t/delete-huge-field-from-index/378784/1 "2025-06-02T08:12:04Z")

</div>

Hi,

due to a bug in our software, we indexed a field with many thousands lines. Now we are short on disk space, but still need the index. What is the best way in ES 8, to get rid of the huge field to get back the disk space? Index size is about 5TB.

A reindex without the field can be problematic, because we don't have that much space left and the index is a monthly index and we are still writing to it.

It should be possible with "\_update\_by\_query" and delete the field with

```auto
"script": "ctx._source.remove('name_of_field')",

```

right? But if so, will I get back the used disk space? Do I need a force merge after deleting it?

Any other ideas?  
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:** [June 2, 2025, 8:47am UTC](https://discuss.elastic.co/t/delete-huge-field-from-index/378784/2 "2025-06-02T08:47:54Z")

</div>

It will be slow and will consume a lot of IO.

> [@ALIT](#):
>
> But if so, will I get back the used disk space?

Not immediately. It will first consume much more disk space.

> [@ALIT](#):
>
> Do I need a force merge after deleting it?

Yes. And you can use: [only\_expunge\_deletes](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-forcemerge#operation-indices-forcemerge-only_expunge_deletes) option.

Reindexing would be better...  
If you still have some disk space, may be "wait" for the month to end and your "old" "bad" indices will be removed???

---

<div class="post-metadata">

**Author:** ![ALIT](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@ALIT](https://discuss.elastic.co/u/ALIT)\
**Post date:** [June 2, 2025, 9:19am UTC](https://discuss.elastic.co/t/delete-huge-field-from-index/378784/3 "2025-06-02T09:19:35Z")

</div>

> [@dadoonet](#):
>
> Yes. And you can use: [only\_expunge\_deletes](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-forcemerge#operation-indices-forcemerge-only_expunge_deletes) option.

Isnt only\_expunge\_deletes for deleted documents? Or does it mean, behind the scenes, ES is writing a new document and the old is going to be deleted afterwards?

> [@dadoonet](#):
>
> Reindexing would be better...  
> If you still have some disk space, may be "wait" for the month to end and your "old" "bad" indices will be removed???

Unfortunately we need to store the index for 14 months.  
But I will try to make some room to reindex it. I also think this is the cleanest solution.

Thanks for your help.

---

<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:** [June 2, 2025, 10:43am UTC](https://discuss.elastic.co/t/delete-huge-field-from-index/378784/4 "2025-06-02T10:43:40Z")

</div>

> [@ALIT](#):
>
> Or does it mean, behind the scenes, ES is writing a new document and the old is going to be deleted afterwards?

That's correct.
