debian-mirror-gitlab/doc/user/search/advanced_search.md

109 lines
5.3 KiB
Markdown
Raw Normal View History

2020-10-24 23:57:45 +05:30
---
2022-07-23 23:45:48 +05:30
stage: Data Stores
2021-01-03 14:25:43 +05:30
group: Global Search
2021-02-22 17:27:13 +05:30
info: "To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments"
2020-10-24 23:57:45 +05:30
type: reference
---
2021-04-17 20:07:23 +05:30
# GitLab Advanced Search **(PREMIUM)**
2019-07-31 22:56:46 +05:30
2022-05-07 20:08:51 +05:30
> Moved to GitLab Premium in 13.9.
2019-07-31 22:56:46 +05:30
2022-07-23 23:45:48 +05:30
Advanced Search uses Elasticsearch for faster, more advanced search across the entire
GitLab instance.
2020-05-24 23:13:21 +05:30
2022-07-23 23:45:48 +05:30
Use Advanced Search when searching in:
2021-04-17 20:07:23 +05:30
- Projects
- Issues
- Merge requests
- Milestones
2022-07-23 23:45:48 +05:30
- Users
- Epics (when searching in a group only)
2021-04-17 20:07:23 +05:30
- Code
2022-07-23 23:45:48 +05:30
- Comments
2021-04-17 20:07:23 +05:30
- Commits
2022-06-21 17:19:12 +05:30
- Wiki (except [group wikis](../project/wiki/group.md))
2021-04-17 20:07:23 +05:30
2022-07-23 23:45:48 +05:30
Advanced Search can be useful in various scenarios:
2021-04-17 20:07:23 +05:30
- **Faster searches:**
Advanced Search is based on Elasticsearch, which is a purpose-built full
text search engine that can be horizontally scaled so that it can provide
search results in 1-2 seconds in most cases.
2021-10-27 15:23:28 +05:30
- **Code Maintenance:**
Finding all the code that needs to be updated at once across an entire
instance can save time spent maintaining code.
2021-09-30 23:02:18 +05:30
This is especially helpful for organizations with more than 10 active projects.
This can also help build confidence is code refactoring to identify unknown impacts.
2021-04-17 20:07:23 +05:30
- **Promote innersourcing:**
Your company may consist of many different developer teams each of which has
their own group where the various projects are hosted. Some of your applications
may be connected to each other, so your developers need to instantly search
throughout the GitLab instance and find the code they search for.
2022-07-23 23:45:48 +05:30
## Configuring Advanced Search
For self-managed GitLab instances, an administrator must
[configure Advanced Search](../../integration/advanced_search/elasticsearch.md).
On GitLab.com, Advanced Search is enabled.
2022-06-21 17:19:12 +05:30
## Advanced Search syntax
2020-10-24 23:57:45 +05:30
2022-06-21 17:19:12 +05:30
See the documentation on [Advanced Search syntax](global_search/advanced_search_syntax.md).
2021-02-22 17:27:13 +05:30
2021-04-17 20:07:23 +05:30
## Search by issue or merge request ID
2021-02-22 17:27:13 +05:30
You can search a specific issue or merge request by its ID with a special prefix.
2021-09-04 01:27:46 +05:30
- To search by issue ID, use prefix `#` followed by issue ID. For example, [#23456](https://gitlab.com/search?snippets=&scope=issues&repository_ref=&search=%2323456&group_id=9970&project_id=278964)
- To search by merge request ID, use prefix `!` followed by merge request ID. For example [!23456](https://gitlab.com/search?snippets=&scope=merge_requests&repository_ref=&search=%2123456&group_id=9970&project_id=278964)
2021-11-11 11:23:49 +05:30
## Global search scopes **(FREE SELF)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68640) in GitLab 14.3.
To improve the performance of your instance's global search, you can limit
the scope of the search. To do so, you can exclude global search scopes by disabling
[`ops` feature flags](../../development/feature_flags/index.md#ops-type).
Global search has all its scopes **enabled** by default in GitLab SaaS and
self-managed instances. A GitLab administrator can disable the following `ops`
feature flags to limit the scope of your instance's global search and optimize
its performance:
| Scope | Feature flag | Description |
|--|--|--|
| Code | `global_search_code_tab` | When enabled, the global search includes code as part of the search. |
| Commits | `global_search_commits_tab` | When enabled, the global search includes commits as part of the search. |
| Issues | `global_search_issues_tab` | When enabled, the global search includes issues as part of the search. |
| Merge Requests | `global_search_merge_requests_tab` | When enabled, the global search includes merge requests as part of the search. |
2022-06-21 17:19:12 +05:30
| Users | `global_search_users_tab` | When enabled, the global search includes users as part of the search. |
2021-12-11 22:18:48 +05:30
| Wiki | `global_search_wiki_tab` | When enabled, the global search includes wiki as part of the search. [Group wikis](../project/wiki/group.md) are not included. |
2022-04-04 11:22:00 +05:30
## Global Search validation
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/346263) in GitLab 14.6 [with a flag](../../administration/feature_flags.md) named `prevent_abusive_searches`. Disabled by default.
FLAG:
On self-managed GitLab, by default this feature is not available. To make it available,
2022-05-07 20:08:51 +05:30
ask an administrator to [enable the feature flag](../../administration/feature_flags.md) named `prevent_abusive_searches`.
The feature is not ready for production use.
2022-04-04 11:22:00 +05:30
To prevent abusive searches, such as searches that may result in a Distributed Denial of Service (DDoS), Global Search ignores, logs, and
doesn't return any results for searches considered abusive according to the following criteria, if `prevent_abusive_searches` feature flag is enabled:
- Searches with less than 2 characters.
- Searches with any term greater than 100 characters. URL search terms have a maximum of 200 characters.
2022-07-23 23:45:48 +05:30
- Searches with a stop word as the only term (for example, "the", "and", "if", etc.).
2022-04-04 11:22:00 +05:30
- Searches with a `group_id` or `project_id` parameter that is not completely numeric.
- Searches with a `repository_ref` or `project_ref` parameter that has special characters not allowed by [Git refname](https://git-scm.com/docs/git-check-ref-format).
- Searches with a `scope` that is unknown.
Regardless of the status of the `prevent_abusive_searches` feature flag, searches that don't
comply with the criteria described below aren't logged as abusive but are flagged with an error:
- Searches with more than 4096 characters.
- Searches with more than 64 terms.