Skip to content

Add Search Migrations Admin API

Terri Chu requested to merge tchu-add-search-migrations-api into master

What does this MR do and why?

Related gitlab-org/search-team/team-tasks#143 (moved)

This MR adds a new Admin API endpoint to expose Advanced Search Migrations.

It's the first step to adding a chatops command (will be done in another MR)

Changes include:

  • two new endpoints: /admin/search/migrations and /admin/search/migrations/:name_or_version
  • expose two new fields in Elastic::MigrationRecord
  • specs

Screenshots or screen recordings

N/A

How to set up and validate locally

  1. enable advanced search/elasticsearch for gdk
  2. index all data in gdk
  3. these are admin API calls so you'll need an access token for the gdk admin account
  4. list all migrations
    curl --request GET \
      --url http://gdk.test:3000/api/v4/admin/search/migrations \
      --header 'Private-Token: YOUR_GDK_ADMIN_TOKEN' \
  5. get a migration by version number
    curl --request GET \
      --url http://gdk.test:3000/api/v4/admin/search/migrations/20201116142400 \
      --header 'Private-Token: YOUR_GDK_ADMIN_TOKEN' \
  6. get a migration by name
    curl --request GET \
      --url http://gdk.test:3000/api/v4/admin/search/migrations/AddNewDataToIssuesDocuments \
      --header 'Private-Token: YOUR_GDK_ADMIN_TOKEN' \
  7. example record json
	{
		"version": 20230503064300,
		"name": "BackfillProjectPermissionsInBlobsUsingPermutations",
		"started_at": "2023-05-03T16:04:44.074+00:00",
		"completed_at": "2023-05-03T16:04:44.074+00:00",
		"completed": true,
		"obsolete": false,
		"migration_state": {
			"permutation_idx": 8,
			"documents_remaining": 5,
			"task_id": "I2_LXc-xQlOeu-KmjYpM8g:172820",
			"documents_remaining_for_permutation": 0
		}
	}

MR acceptance checklist

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

Edited by Terri Chu

Merge request reports

Loading