Advanced Search Syntax (STARTER)
- Introduced in GitLab Enterprise Starter 9.2
NOTE: Advanced Search (powered by Elasticsearch) is enabled for Bronze and above on GitLab.com since 2020-07-10.
Use advanced queries for more targeted search results.
This is the user documentation. To install and configure Elasticsearch, visit the administrator documentation.
Overview
The Advanced Search Syntax is a subset of the Advanced Search, which you can use if you want to have more specific search results.
Advanced Search only supports searching the default branch.
Using the Advanced Search Syntax
The Advanced Search Syntax supports fuzzy or exact search queries with prefixes, boolean operators, and much more.
Full details can be found in the Elasticsearch documentation, but here's a quick guide:
- Searches look for all the words in a query, in any order - e.g.: searching
issues for
display bug
andbug display
will return the same results. - To find the exact phrase (stemming still applies), use double quotes:
"display bug"
- To find bugs not mentioning display, use
-
:bug -display
- To find a bug in display or banner, use
|
:bug display | banner
- To group terms together, use parentheses:
bug | (display +banner)
- To match a partial word, use
*
. In this example, I want to find bugs with any 500 errors. :bug error 50*
- To use one of symbols above literally, escape the symbol with a preceding
\
:argument \-last
Syntax search filters
The Advanced Search Syntax also supports the use of filters. The available filters are:
- filename: Filters by filename. You can use the glob (
*
) operator for fuzzy matching. - path: Filters by path. You can use the glob (
*
) operator for fuzzy matching. - extension: Filters by extension in the filename. Please write the extension without a leading dot. Exact match only.
- blob: Filters by Git
object ID
. Exact match only.
To use them, add them to your keyword in the format <filter_name>:<value>
without
any spaces between the colon (:
) and the value. When no keyword is provided, an asterisk (*
) will be used as the keyword.
Examples:
- Finding a file with any content named
search_results.rb
:* filename:search_results.rb
- The leading asterisk (
*
) can be ignored in the case above:filename:search_results.rb
- Finding a file named
found_blob_spec.rb
with the textCHANGELOG
inside of it:CHANGELOG filename:found_blob_spec.rb
- Finding the text
EpicLinks
inside files with the.rb
extension:EpicLinks extension:rb
- Finding any file with the
.yaml
extension:extension:yaml
- Finding the text
Sidekiq
in a file, when that file is in a path that includeselastic
:Sidekiq path:elastic
- Finding any file in a path that includes
elasticsearch
:path:elasticsearch
- Finding the files represented by the Git object ID
998707b421c89bd9a3063333f9f728ef3e43d101
:* blob:998707b421c89bd9a3063333f9f728ef3e43d101
- Syntax filters can be combined for complex filtering. Finding any file starting with
search
containingeventHub
and with the.js
extension:eventHub filename:search* extension:js
Excluding filters
Introduced in GitLab Starter 13.3.
Filters can be inverted to filter out results from the result set, by prefixing the filter name with a -
(hyphen) character, such as:
-filename
-path
-extension
-blob
Examples:
- Finding
rails
in all files butGemfile.lock
:rails -filename:Gemfile.lock
- Finding
success
in all files excluding.po|pot
files:success -filename:*.po*
- Finding
import
excluding minified JavaScript (.min.js
) files:import -extension:min.js
- Finding
docs
for all files outside thedocs/
folder:docs -path:docs/
Search by issue or merge request ID
You can search a specific issue or merge request by its ID with a special prefix.