Skip to content

Add schema_version to notes

Ravi Kumar requested to merge 372856-add-schema_version-to-notes into master

What does this MR do and why?

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

Screenshots or screen recordings

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

Before After
Screenshot_2023-08-24_at_12.59.43 Screenshot_2023-08-24_at_13.01.32

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-notes/_mapping/field/schema_version'
  1. Now open the rails console
bundle exec rails c
  1. Run the following command in the console
Elastic::DataMigrationService[20230824114205].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 note(comment) and check that note in the elastic. Verify that the 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)

#384596 (closed)

Edited by Ravi Kumar

Merge request reports