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

image

References

!197924 (merged)

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. In rails c manually trigger the migration to run with Elastic::MigrationWorker.new.perform
  3. You can then check that milestone_state was added to the work items mapping with curl http://localhost:9200/gitlab-development-work_items/_mappings | jq .
  4. Pick an issue and assign a milestone to it. First, let it be active milestine, then close it.
  5. Another test is for elastic_index_dependant_association to 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).
  6. 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)

Merge request reports

Loading