Skip to content

Allow elasticsearch index to be reset from the admin panel

This should be placed after step 2 of ES admin panel frontend work to avoid duplicated work: https://gitlab.com/gitlab-org/gitlab-ee/issues/13534

Problem to solve

While discussing the elasticsearch on GitLab.com MVC with @mwasilewski-gitlab , I realised that we currently have no way to self-serve index resets as GitLab administrators. At present, we require a system administrator to run the following two rake tasks:

gitlab-rake gitlab:elasticsearch:create_empty_index
gitlab-rake gitlab:elasticsearch:clear_index_status

Intended users

Instance administrators setting up / tweaking elasticsearch integration

Further details

We need to reset the index status in a variety of scenarios, particularly when changes are made between versions of GitLab. At present this is a manual process. Doing it requires elevated sysadmin privileges, and it would be easy to get it wrong.

Proposal

Add a huge, scary, bright red, multiple-levels-of-confirmation-required, button to the elasticsearch integration section of the admin settings. This button will enqueue a sidekiq job that:

  • Recreates the index from scratch
  • Clears the index_status table
  • Enqueues any sidekiq jobs necessary to populate the empty index

Permissions and Security

This should only be available to the instance administrator

Documentation

https://docs.gitlab.com/ee/integration/elasticsearch.html would need modifying to suit

Testing

Usual unit and integration testing

What does success look like, and how can we measure that?

An instance adminstrator can reset their elasticsearch index and return to a working state without needing to resort to rake tasks

What is the type of buyer?

GitLab Starter

Links / references

Edited by Mark Chao