Description
We would like to be able to reduce the number of deleted documents in our indexes, as we are spending a lot of money on disk space for deleted documents that are not reclaimed.
In our use case all of our indexes are permanently "hot" (to use ILM terminology). We have large volumes of continuous updates and deletes (sometimes almost all docs in an index will need to be updated multiple times), and we end up with lots of deleted documents. We have set deletes_pct_allowed
, which works, but won't go below 20% (I believe this is a Lucene limit). When you have a 25TB index with 20% deleted docs that's 5TB of essentially wasted disk space that we can't reclaim without reindexing. We don't want to have to reindex repeatedly, it requires extra effort from our Ops team. Given that all of our indexes are sitting at 20% deleted documents, you can see how this is a significant monetary expense for us.
We'd like some way to get the deleted document count in an index down to 0 (or at least a lot lower than 20%) but we don't want to use force merge because of the current catch that you can end up with segments greater than 5GB. Force merge seems optimised for the use case of one-off merges down to a single segment, but I think because our indexes are always hot we don't want to merge down to one segment. We'd prefer to be able to set deletes_pct_allowed
to be lower, but would settle for being able to expunge deletes occasionally, and otherwise let normal merging go about its business.
My proposal is that force merge (or just the expunge deletes function) be modified so that it optionally respects the max segment size limit, which was implemented by Lucene. Currently EsTieredMergePolicy overrides the normal Lucene TieredMergePolicy such that max segment size is not respected, and there doesn't seem to be a way around that for users.
There's a related issue here but I wanted to propose a specific change (maybe it's not the right change!) and also explain how this affects us.