For self-hosted instances you can use Advanced Global Search https://docs.gitlab.com/ee/user/search/advanced_global_searc... to do this. Please note that this requires installation of Elastic Search. It used to be a paid feature but I think we recently open sourced it.