In Typesense, writes are first written to a write-ahead-log (WAL) on disk and then they are applied to the in-memory index.
This WAL is compacted every hour to a snapshot. On restart, the last snapshot is loaded and then the last hour of the WAL is replayed.
So when you delete and then immediately restart before the snapshot has happened, it's essentially reloading the entire collection from the previous snapshot and then it replays the WAL.
To avoid this you can snapshot manually using the snapshot endpoint before a restart. And then that latest snapshot will no longer have the data you're trying to delete