Skip to content

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 IssuesNew issue → Select "Issue"
INCIDENT Incident issue type IssuesNew issue → Select "Incident"
TEST_CASE Test Case issue type BuildTest casesNew test case
REQUIREMENT Requirement issue type PlanRequirementsNew requirement
TASK Task issue type IssuesNew issue → Select "Task"
TICKET
EPIC Epic issue type Epics > New 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 /search page web UI, there is a dedicated scope for epics. However, this was not working for GLQL when searching for type = 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

  1. Follow this guide to have ES enabled locally for GDK
  2. GLQL relies on crypto.subtle, which is unavailable in insecure contexts (except for localhost), it won’t work if you're using a custom URL like http://gdk.test:3000 locally. To resolve this, one of the options is to enable HTTPS in GDK by following this link.
  3. Enable the following two feature flags in rails c:
=> Feature.enable(:glql_integration)
=> Feature.enable(:glql_work_items)
  1. Navigate to any issue comment or description field where Markdown is supported
  2. 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)
```
  1. Test with different type fields variations.
  2. 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

Merge request reports

Loading