Group transfer creates duplicate epic documents in Elastic
Summary
When we transfer a group's namespace, then it creates duplicate epics documents in Elastic. However, in the search result, there will be no duplicates because we are searching with routing and the old duplicate record has the wrong routing so it will not be in the search hits.
Steps to reproduce
Create epic in a group. Check on the Elastic it is indexed. Now transfer the group to a different namespace. Check on Elastic that each epic document has a duplicate.
What is the current bug behavior?
Epic has duplicate documents in the Elastic
What is the expected correct behavior?
Epic should not have duplicate documents in the Elastic
Relevant logs and/or screenshots
In the screenshot, there are two records of the epic. The duplicate record is created after the group transfer
Possible fixes
After fixing the bug don't forget to remove the duplicates from the Elastic. A migration is needed to do that.