Does removing field actually deletes data?

Hello. I want to free some space on HDD so I decided to remove unneeded field from my indices.
I made a reindex with field deletion on some index. Then I compared sizes of old index and new index without some fields. And sizes are almost identical.

So, does field removal actually remove data that was contained in these fields?

Hi @74db36a597f21b891b3f,

When updating a document using the index API a new version of the document is always created even if the document hasn’t changed. The old document is marked as deleted logically. Behind the scenes, Elasticsearch will periodically merge segments of the indices and delete the flagged documents.

After the reindex operation you can force a cleanup using the _forcemerge API with the only_expunge_deletes parameter:

POST INDEX_NAME/_forcemerge?only_expunge_deletes=true&flush=true

IMPORTANT: The force merge API should be used only on special occasions and preferably on read-only indices.

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