Force reindexing of wikis does not delete the existing documents
Summary
When we do force reindexing of wikis, it does not delete the existing documents.
Steps to reproduce
Change the namespace of any project which has wikis. Now check on Elastic that each wiki page has duplicate documents. One with the old root namespace and the second with the new root namespace.
What is the current bug behavior?
With the force reindexing of wikis, it creates new documents without deleting the old ones.
What is the expected correct behavior?
With the force reindexing of wikis, it should create new documents after deleting the old ones.
Relevant logs and/or screenshots
Possible fixes
The problem is when a root namespace gets changed for a wiki we are deleting the older documents but the query search for the older documents in the routing with the new root namespace. Here is the code. However, it should route to the old root namespace. Pass the old_namespace
as well in the WikiIndexerWorker
just like Search::Zoekt::ProjectTransferWorker