Advanced search - add milestone to work item index

Problem to solve

We're working on a proof of concept for GLQL to hook into advanced search. The two most important fields are milestone (not present) and labels (present). Both fields are needed to do the proof of concept

https://docs.gitlab.com/user/glql/fields/#milestone

Proposal

Support querying by milestone for work items by adding the milestone_title to indexed data.

Adding new field and keep updated

  1. Add a new field milestone_title with type keyword to the index mapping in the base_mappings method in Search::Elastic::Types::WorkItem
  2. Add an advanced search migration to add the new field using the MigrationUpdateMappingsHelper
  3. In Search::Elastic::References::WorkItem
    • populate the new field in the build_indexed_json method, add a gate to ensure the migration created above has completed
    • bump the SCHEMA_VERSION to a new value (YYYYWW, year and week number)
  4. in the EE milestone model, all associated issues should be queued for indexing using Elastic::ProcessBookkeepingService.track! when the milestone is updated if:
    • the title field is updated
    • use_elasticsearch? is true for the record,
  5. milestone must be added to preload_indexing_data in the EE work item model

Backfilling data

  1. Add an advanced search migration to populate the new field using the MigrationBackfillHelper
Edited by Terri Chu