Advanced search
- Tier: Premium, Ultimate
- Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
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
- Code
- Comments
- Commits
- Project and group wikis
Enable advanced search
- For GitLab.com and GitLab Dedicated, advanced search is enabled in paid subscriptions.
- For GitLab Self-Managed, an administrator must enable advanced search.
Syntax
Advanced search uses simple_query_string
,
which supports both exact and fuzzy queries.
When you search for a user, the fuzzy
query is used by default.
You can refine user search with simple_query_string
.
Syntax | Description | Example |
---|---|---|
" | Exact search | "gem sidekiq" |
~ | Fuzzy search | J~ Doe |
| | 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 (full or partial matches) | path:spec/workers/ |
extension: | File extension without . (exact matches only) | extension:js |
blob: | Git object ID (exact matches only) | blob:998707* |
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. |
helper path:lib/git | Returns helper in all files with a lib/git* path (for example, spec/lib/gitlab ). |
Known issues
You can only search files smaller than 1 MB. For more information, see issue 195764. For GitLab Self-Managed, an administrator can configure the Maximum file size indexed setting.
You can use advanced search on the default branch of a project only. For more information, see issue 229966.
The search query must not contain any of the following characters:
. , : ; / ` ' = ? $ & ^ | < > ( ) { } [ ] @
For more information, see issue 325234.
Search results show only the first match in a file. For more information, see issue 668.
Docs
Edit this page to fix an error or add an improvement in a merge request.
Create an issue to suggest an improvement to this page.
Product
Create an issue if there's something you don't like about this feature.
Propose functionality by submitting a feature request.
Feature availability and product trials
View pricing to see all GitLab tiers and features, or to upgrade.
Try GitLab for free with access to all features for 30 days.
Get help
If you didn't find what you were looking for, search the docs.
If you want help with something specific and could use community support, post on the GitLab forum.
For problems setting up or using this feature (depending on your GitLab subscription).
Request support