Search in Deckhouse Code helps you quickly find the information you need across projects, groups, or the entire instance. Results are ranked by relevance and allow you to jump directly to the source object.

Advanced search powered by OpenSearch allows you to:

  • find code patterns across all accessible projects;
  • track usage of deprecated functions and libraries;
  • search comments on issues and merge requests;
  • find commits by message or SHA;
  • search wiki page content.

To search:

  1. In the top bar, select “Search”.
  2. Enter your search term.
  3. Press “Enter”.

You can also use advanced search in a project or group context.

When OpenSearch is enabled, Deckhouse Code uses it as the backend for advanced search scopes (issues, merge requests, code, and others). For REST API parameters, filters, and response format, see the “Search API” section.

Search scopes

Scopes describe the type of data you are searching.

The following scopes are available for basic search (without OpenSearch):

ScopeGlobalGroupProject
Code
Comments
Commits
Issues
Merge requests
Milestones
Projects
Users
Wiki

When OpenSearch is enabled, the following scopes are available:

ScopeGlobalGroupProject
Code
Comments
Commits
Issues
Merge requests
Milestones
Projects
Users
Wiki

When OpenSearch is enabled, search for code, commits, wiki, and comments runs through OpenSearch and respects the access matrix. Users see only objects they have permission to read. Search for issues, merge requests, and other entities runs through the database.

The tables above describe search scopes in the web interface. The set of scopes in the REST API differs: there, search for code, commits, comments, and wiki is only available at the project level. For details, see “API search scopes”.

General procedure for searching in Deckhouse Code:

  1. Click “Search” in the top navigation bar.
  2. Enter a search query.
  3. Press “Enter” — results appear on the search page.
  4. Use filters to refine results by group, project, or object type.

Search

Allows searching across all projects and groups within the instance.

  1. In the left menu, select “Search”.
  2. Enter a query and press “Enter”.
  1. Open the target project.
  2. In the left menu, select “Search”.
  3. Enter a query and press “Enter”.
  1. Open the target group.
  2. In the left menu, select “Search”.
  3. Enter a query and press “Enter”.

Additional features

  • Search supports query completion for projects, groups, and users.
  • When advanced search is enabled, query completion also works for commit messages, filenames, code, issues, and merge requests.
  • When searching, you can quickly navigate to a commit by its SHA.

Syntax

Advanced search supports extended query syntax: exact and fuzzy matching, logical operators, and filters.

SyntaxDescriptionExample
"Exact search"gem sidekiq"
~Fuzzy searchJ~ Doe
|Ordisplay | banner
+Anddisplay +banner
-Excludedisplay -banner
*Partial matchbug error 50*
\Escape\*md
#Issue ID (in comments)#23456
!Merge request ID (in comments)!23456
SyntaxDescriptionExample
filename:Filenamefilename:*spec.rb
path:Repository location (full or partial matches)path:spec/workers/
extension:File extension without .extension:js
blob:Git object IDblob:998707*

The code search UI also provides a language filter.

Examples

QueryDescription
rails -filename:gemfile.lockReturns rails in all files except gemfile.lock
RSpec.describe Resolvers -*builderReturns RSpec.describe Resolvers excluding matches starting with builder
bug | (display +banner)Returns bug or both display and banner
helper -extension:yml -extension:jsReturns helper in all files except .yml and .js files
helper path:lib/gitReturns helper in files with a lib/git* path (for example, spec/lib/gitlab)

Indexing settings

Project settings

A project maintainer can go to “Settings” → “Search”.

Branch regex

When Allow per-project branch regex is enabled at the instance level, the maintainer can specify a regex for additional branches. The default branch is always indexed.

Example regex: (feature|hotfix)/.*

Changing the regex triggers a full project reindex.

Reindex code and wiki

  • Reindex code — full reindex of the repository code.
  • Reindex wiki — full reindex of the wiki (if a wiki repository exists).

The “Index up to date” badge shows whether indexing is complete for the current repository state.

Group settings

A group owner can go to “Settings” → “Search”.

Group wiki reindexing is available: index status and the “Reindex wiki” button.

Search API

Search REST API lets you conduct a search across a Deckhouse Code instance, a specific group, or a project.

Endpoints

The following endpoints are available for searching:

  • GET /api/v4/search: Search across a Deckhouse Code instance.
  • GET /api/v4/groups/:id/search (or /api/v4/groups/:id/-/search): Search in a group.
  • GET /api/v4/projects/:id/search (or /api/v4/projects/:id/-/search): Search in a project.

All endpoints require authentication.

API search scopes

A search scope is defined via the required parameter scope. Supported values differ by endpoints:

Scope valueInstanceGroupProjectBackend when OpenSearch is enabled
projectsPostgreSQL
usersPostgreSQL
snippet_titlesPostgreSQL
issuesOpenSearch (advanced)
work_itemsOpenSearch (advanced)
merge_requestsOpenSearch (advanced)
milestonesOpenSearch (advanced)
notesOpenSearch (advanced)
wiki_blobsOpenSearch (advanced)
commitsOpenSearch (advanced)
blobsOpenSearch (advanced)

The response header X-Search-Type returns the resolved search type.

The set of API scopes differs from the search scopes in the web interface: the blobs, commits, notes, and wiki_blobs values are only supported by the project endpoint, while in the interface these scopes are also searchable globally and per group.

Request parameters

Common parameters

ParameterTypeRequiredEndpointsNotes
searchstringYesAllSearch query
scopestringYesAllSearch scope. See the earlier table for available values
confidentialbooleanNoAllPassed to search service
include_archivedbooleanNoInstance, groupNot available for searching in a project
page / per_pageintegerNoAllOffset pagination
refstringNoProjectBranch or tag for project search
statestringNoAllObject state: all, opened, closed, merged
typearray[string]NoAllWork item type filter (effective for work_items)

Additional parameters

Support for additional parameters depends on the selected search scope. If a parameter is submitted with invalid scope values, API returns the 400 response with the message <PARAM_NAME> is supported only for <SCOPE_LIST>.

ParameterTypeApplies to scopeRestrictions
author_usernamestringmerge_requestsAuthor filter
exclude_forksbooleanwork_items, issuesOnly in these scope values
fieldsarray[string]work_items, issuesOnly title is supported. For other values, API returns 400
label_namearray[string]work_items, issues, merge_requestsComma-separated values are supported
languagearray[string]blobsComma-separated values are supported
not_author_usernamestringmerge_requestsAuthor exclusion filter
not_source_branchstringmerge_requestsExclusion filter
not_target_branchstringmerge_requestsExclusion filter
num_context_linesintegerblobsSupported range 0..20
source_branchstringmerge_requestsExact branch filter
target_branchstringmerge_requestsExact branch filter

Response headers

The API can return the following headers:

  • X-Search-Type: Resolved search type for current request.
  • X-Search-Aggregations: Present only when OpenSearch is enabled and aggregations exist for the requested scope.

The aggregation scope depends on the scope value:

Scope valueAggregations
blobslanguage
work_items, issueswork_item_type_ids, labels
merge_requestslabels

Response body

The endpoint returns a JSON array of scope-specific entities:

Scope valueEntity type
issuesIssueBasic
work_itemsWorkItem
merge_requestsMergeRequestBasic
milestonesMilestone
notesNote
commitsCommit
blobsBlob
wiki_blobsBlob
projectsBasicProjectDetails
usersUserBasic
snippet_titlesSnippet

Request examples

Instance search: issues/work items with labels and fields

curl --request GET \
  --header "PRIVATE-TOKEN: <ACCESS_TOKEN>" \
  --url "https://gitlab.example.com/api/v4/search?scope=issues&search=deploy&fields=title&label_name=team%3Aplatform&exclude_forks=true"

Group search: merge requests with filters

curl --request GET \
  --header "PRIVATE-TOKEN: <ACCESS_TOKEN>" \
  --url "https://gitlab.example.com/api/v4/groups/my-group/-/search?scope=merge_requests&search=release&source_branch=release%2F1.2&not_author_username=bot"

Project search: code blobs with context lines

curl --request GET \
  --header "PRIVATE-TOKEN: <ACCESS_TOKEN>" \
  --url "https://gitlab.example.com/api/v4/projects/my-group%2Fmy-project/-/search?scope=blobs&search=deploy&num_context_lines=5&language=Ruby"

Additional resources