Elastic rake tasks projects_not_indexed and index_projects_status could be confusing

Summary

Elastic rake tasks gitlab:elastic:projects_not_indexed and gitlab:elastic:index_projects_status could be confusing if there are empty projects under a namespace. Since empty projects never get indexed, that's why IndexStatus record never gets created. That is why empty projects are considered non-indexed. Hence, in the rake tasks, it displays the message that indexing is not completed.

Steps to reproduce

Create a new empty project. Run rake tasks gitlab:elastic:projects_not_indexed or gitlab:elastic:index_projects_status

What is the current bug behavior?

It shows a message like indexing is not complete

What is the expected correct behavior?

It should show a message that indexing is completed

Relevant logs and/or screenshots

Screenshot_2025-10-06_at_15.46.45

Possible fixes

Call CommitIndexerWorker here: https://gitlab.com/gitlab-org/gitlab/-/blob/0eaea5489c51cf248ae7b1552d867cf5137104ab/ee/app/models/concerns/elastic/projects_search.rb#L30 to ensure indexing is called for all projects.

Edited by Ravi Kumar