Search service incorrectly uses elasticsearch when indexing, but not search, is enabled
Originally spotted in https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues/6587
::Project
has a use_elasticsearch?
method that is designed to tell us whether we should index the project or not. However, the project search service uses it unconditionally to decide whether to search using elasticsearch or not:
# Project
def use_elasticsearch?
::Gitlab::CurrentSettings.elasticsearch_indexes_project?(self)
end
# ApplicationSetting
def elasticsearch_indexes_project?(project)
return false unless elasticsearch_indexing?
return true unless elasticsearch_limit_indexing?
elasticsearch_limited_projects.exists?(project.id)
end
# Search::ProjectService
def use_elasticsearch?
project.use_elasticsearch?
end
The same problem exists in group, but not global, search.
Since we need this to work properly before we can use elasticsearch on GitLab.com, I'll assign this to myself and %12.0 . cc @DouweM @phikai @mdelaossa