The current code optimizes the case when all values for a given field value pair are deleted by removing all documents in ESC and ECC.
Now, when a user deletes all field/value pairs. One null document should remain in ESC one null document in ECC, and one gap document in ECC.
In the code, remove the allEntriesDeleted clauses.