Advanced search - add new fields to work item index
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Description
We currently need to support filtering by the following fields (please refer to GLQL fields docs for more info):
iterationiteration cadencecustom statuscustom fieldsubscribedemoji reactiontitle
So these fields need to be update to the ES work items index. It will require some investigation to decide how to store these field in ES and what data type they should be (it depends on how this data is also stored in postgres).
Implementation
Follow the documentation on how to add new fields to the work_items index, populate the new fields and keep the records in sync (https://docs.gitlab.com/development/advanced_search/#adding-a-field).
Part 1: Adding new field and keep updated
- Add new fields to the index mapping in the
base_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
- Check whether this
preload_indexing_dataN+1 spec should be updated for iteratiom, cadence and parent link since we are now indexing work items relations:- the specs for indexing are
ee/spec/services/elastic/process_bookkeeping_service_spec.rb
- the specs for indexing are
- Sample MR
Part 2: Backfilling data
- Add an advanced search migration to populate the new field using the
MigrationBackfillHelper- use
MigrationReindexBasedOnSchemaVersioninstead ofMigrationBackfillHelpersince these fields are nullable
- use
- sample MR