Skip to content

Add schema_version to merge_requests

What does this MR do and why?

This MR adds an integer field schema_version in the merge_requests mapping. This field is useful in the case of reindexing all documents of merge_requests

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After
Screenshot_2023-08-23_at_17.22.53 Screenshot_2023-08-23_at_17.24.01

How to set up and validate locally

  1. Ensure Elasticsearch is enabled
  2. Run the following command and ensure the mappings in the response is empty
curl -H 'Content-type: application/json' -XGET 'http://localhost:9200/gitlab-development-merge_requests/_mapping/field/schema_version'
  1. Now open the rails console
bundle exec rails c
  1. Run the following command in the console
Elastic::DataMigrationService[20230823154049].send(:migration).migrate
  1. Now again run the curl command in the bash terminal and ensure the mapping in the response has the values.
  2. Now edit or create any MR and check that MR in the elastic. Verify that schema_version field is populated.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #372856 (closed)

#384594 (closed)

Edited by Ravi Kumar

Merge request reports

Loading