Elasticsearch limited project indexes are not maintained when search is disabled
Summary
Spotted while working on https://gitlab.com/gitlab-org/gitlab-ee/issues/11419
If "Elasticsearch indexing" is enabled but "Search using elasticsearch" is disabled, then adding or removing a project to the "Elasticsearch limited projects" section of the elasticsearch integration settings in the admin panel has no effect.
Steps to reproduce
- Start with an empty index
- Enable indexing, disable search
- Add
gitlab-org/gitlab-test
to "Elasticsearch indexed projects"
What is the current bug behavior?
No documents are added to the index
What is the expected correct behavior?
Regardless of whether we're searching using ES, the index should be correctly maintained
Possible fixes
Since we use Project#searchable?
here, we take account of Gitlab::CurrentSettings.elasticsearch_search?
, when we shouldn't.
Same for when a project is removed - we want it to be deleted from the index as long as indexing is turned on.