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
- Add a new field
milestone_titlewith typekeywordto the index mapping in thebase_mappingsmethod inSearch::Elastic::Types::WorkItem - Add an advanced search migration to add the new field using the
MigrationUpdateMappingsHelper - In
Search::Elastic::References::WorkItem- populate the new field in the
build_indexed_jsonmethod, add a gate to ensure the migration created above has completed - bump the
SCHEMA_VERSIONto a new value (YYYYWW, year and week number)
- populate the new field in the
- in the EE milestone model, all associated issues should be queued for indexing using
Elastic::ProcessBookkeepingService.track!when the milestone is updated if:- the
titlefield is updated -
use_elasticsearch?is true for the record,
- the
- milestone must be added to
preload_indexing_datain the EE work item model- the specs for indexing are
ee/spec/services/elastic/process_bookkeeping_service_spec.rband the N+1 checks for work items should be updated to create multiple milestones for work items
- the specs for indexing are
Backfilling data
- Add an advanced search migration to populate the new field using the
MigrationBackfillHelper
Edited by Terri Chu