Part 1: Advanced Search - Add milestone state to work items index
What does this MR do and why?
We also need milestone state to be able to replicate upcoming and started milestone scopes in Elasticsearch.
I am adding a new milestone_state keyword field to work items mapping. At the moment it holds two possible values: closed and active
References
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
- Follow this guide to have ES enabled locally for GDK
- In
rails cmanually trigger the migration to run withElastic::MigrationWorker.new.perform - You can then check that
milestone_statewas added to the work items mapping withcurl http://localhost:9200/gitlab-development-work_items/_mappings | jq . - Pick an issue and assign a milestone to it. First, let it be active milestine, then close it.
- Another test is for
elastic_index_dependant_associationto make sure that when milestone is set to active/closed, this change is also reflected in ES index for all existing work items (see step 8 on how to do it). - You can use the below snipped to test that we have the proper values in the ES index (make sure to set the correct issue id to
"id"field in terms query;"_source"specifies which fields you to fetch, if you remove it, you'd get all fields returned):
curl -X GET "http://localhost:9200/gitlab-development-work_items/_search" \
-H "Content-Type: application/json" \
-d '{
"query": {
"term": {
"id": 652
}
},
"_source": ["milestone_state"]
}'
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 #547410 (closed)
