GLQL - search ES Work Items by type (excluding Epics)
What does this MR do and why?
This MR adds support for searching WorkItems by type in GLQL with Elasticsearch integration. WorkItems in GitLab support multiple types listed in the table below:
| Type | Description | Creation Path |
|---|---|---|
ISSUE |
Standard issue type | Issues → New issue → Select "Issue" |
INCIDENT |
Incident issue type | Issues → New issue → Select "Incident" |
TEST_CASE |
Test Case issue type | Build → Test cases → New test case |
REQUIREMENT |
Requirement issue type | Plan → Requirements → New requirement |
TASK |
Task issue type | Issues → New issue → Select "Task" |
TICKET |
||
EPIC |
GLQL support single type search with = operator and multiple type search with in operator:
Single Type Queries
| GLQL Query | WorkItems Finder | ES Filter Name |
|---|---|---|
type = Task |
issue_types: ["task"] |
work_item_type_ids: [5] |
type = Requirement |
issue_types: ["requirement"] |
work_item_type_ids: [4] |
Multiple Type Queries (IN Logic)
| GLQL Query | WorkItems Finder | ES Filter Name |
|---|---|---|
type in (Requirement, Task) |
issue_types: ["requirement", "task"] |
work_item_type_ids: [4, 5] |
Notes
- When searching for epics via Elasticsearch from the
/searchpage web UI, there is a dedicated scope for epics. However, this was not working for GLQL when searching fortype = Epic(see related slack conversation). - Epics should have an empty feature type and a different project visibility level (see related slack conversation).
-
❗ Epics are not in the scope if this MR. There should be done more changes to make Epic type work, will be done as a part of this separate issue #553329 (closed)
References
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
- Follow this guide to have ES enabled locally for GDK
- GLQL relies on
crypto.subtle, which is unavailable in insecure contexts (except forlocalhost), it won’t work if you're using a custom URL likehttp://gdk.test:3000locally. To resolve this, one of the options is to enable HTTPS in GDK by following this link. - Enable the following two feature flags in
rails c:
=> Feature.enable(:glql_integration)
=> Feature.enable(:glql_work_items)
- Navigate to any issue comment or description field where Markdown is supported
- Add the following GLQL query into the field:
```glql
display: table
fields: title, labels("workflow::*"), author, labels
query: group = "gitlab-org" and type in (Epic, Requirement, Task)
```
- Test with different
typefields variations. - Also, for epics it's important to check that we kept the proper visibility level not exposing confidential epics. Please follow testing steps from here to validate that !183748 (merged)
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #540820 (closed)
Edited by Alisa Frunza