Advanced Search (PREMIUM)

Moved to GitLab Premium in 13.9.

You can use Advanced Search for faster, more efficient search across the entire GitLab instance. Advanced Search is based on Elasticsearch, a purpose-built full-text search engine you can horizontally scale to get results in up to a second in most cases.

You can find code you want to update in all projects at once to save maintenance time and promote innersourcing.

You can use Advanced Search in:

  • Projects
  • Issues
  • Merge requests
  • Milestones
  • Users
  • Epics (in groups only)
  • Code
  • Comments
  • Commits
  • Project wikis (not group wikis)

For Advanced Search:

  • You can only search files smaller than 1 MB. For self-managed GitLab instances, an administrator can change this limit.

  • You can't use any of the following characters in the search query:

    . , : ; / ` ' = ? $ & ^ | ~ < > ( ) { } [ ] @
  • Only the default branch of a project is indexed for code search. In a non-default branch, basic search is used.

  • Search results show only the first match in a file, but there might be more results in that file.

Enable Advanced Search

  • On GitLab.com, Advanced Search is enabled for groups with paid subscriptions.
  • For self-managed GitLab instances, an administrator must enable Advanced Search.

Syntax

Advanced Search uses Elasticsearch syntax. The syntax supports both exact and fuzzy search queries.

Syntax Description Example
" Exact search "gem sidekiq"
| Or display | banner
+ And display +banner
- Exclude display -banner
* Partial bug error 50*
\ Escape \*md
# Issue ID #23456
! Merge request ID !23456

Code search

Syntax Description Example
filename: Filename filename:*spec.rb
path: Repository location path:spec/workers/
extension: File extension without . extension:js
blob: Git object ID blob:998707*

extension: and blob: return exact matches only.

Examples

Query Description
rails -filename:gemfile.lock Returns rails in all files except the gemfile.lock file.
RSpec.describe Resolvers -*builder Returns RSpec.describe Resolvers that does not start with builder.
bug | (display +banner) Returns bug or both display and banner.
helper -extension:yml -extension:js Returns helper in all files except files with a .yml or .js extension.