Remove notes fields from work items index

What does this MR do and why?

This change improves how Elasticsearch migrations handle document types and field removal operations. The main updates include:

Simplified Configuration: The migration system now uses a DOCUMENT_TYPE constant instead of requiring separate index_name and document_type methods, making it easier to configure migrations.

Enhanced Field Removal: Updated the field removal helper to be more robust by adding a minimum match requirement when checking for existing fields, which improves the reliability of field removal operations.

New Migration Implementation: Added two new migrations specifically for WorkItem documents - one to remove the notes and notes_internal fields from the search index, and another to reindex WorkItems after the field removal.

Better Type Handling: Introduced a new es_document_type method that automatically converts document types to the proper format (lowercase and underscored) for Elasticsearch queries, reducing manual configuration.

Improved Testing: Enhanced test utilities to use Painless scripting language properly when updating documents during tests, making the test suite more reliable.

The overall goal is to clean up the WorkItem search index by removing note-related fields while making the migration system more maintainable and easier to use for future changes.

References

Screenshots or screen recordings

Before After

How to set up and validate locally

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.

Edited by Terri Chu

Merge request reports

Loading