Environment: MongoDB 4.2.7, Centos7
I have a collection with about 500 million document and an index that is about 8GB. If I delete half the documents, I would expect the indexSize to decrease by about 50%. But I don't. Why does it not go down? Is there a way to compact the index?
Just to verify that the index should be smaller, I copied 50% of the documents to a brand new mongodb instance and created the index there. The index is indeed about 50% less.