Clean up indexed namespaces
Summary
There are namespaces indexed on .com in Advanced search which should not be indexed due to not being on a paid plan
context: https://gitlab.com/gitlab-org/gitlab/-/issues/439208#note_1748303915
Possible fixes
SQL to generate count
SELECT
count("elasticsearch_indexed_namespaces".*)
FROM
"elasticsearch_indexed_namespaces"
WHERE
"elasticsearch_indexed_namespaces"."namespace_id" NOT IN (
SELECT
"gitlab_subscriptions"."namespace_id"
FROM
"gitlab_subscriptions"
INNER JOIN "plans" ON "plans"."id" = "gitlab_subscriptions"."hosted_plan_id"
WHERE
"plans"."name" IN ('bronze', 'silver', 'premium', 'gold', 'ultimate', 'ultimate_trial', 'ultimate_trial_paid_customer', 'premium_trial', 'opensource')
AND (end_date IS NULL
OR end_date >= '2024-01-21'))
Create a data migration to slowly batch through all of the incorrectly indexed namespaces and remove them from elasticsesarch_indexed_namesapces
table. The ElasticsearchIndexedNamespace
model has callbacks that will delete the records asynchronously
Edited by Terri Chu