Skip to content

Show warning if code search mappings are outdated

Dmitry Gruzd requested to merge 346914-admin-warning into master

What does this MR do and why?

This MR depends on !96785 (merged) and marked as draft to prevent accidental merge

This MR shows a warning for self-managed customers if it detects that mappings are outdated to recommend them reindex their instance in order to improve code search quality.

Screenshots or screen recordings

Screenshot_2022-09-29_at_18.16.33

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Enable Advanced Search if it's not enabled
  2. Open /admin/application_settings/advanced_search
  3. If you don't see the warning, you have a fresh index, so you might want to update its meta field by running
    curl -H 'Content-type: application/json' -XPOST 'http://localhost:9200/gitlab-development/_mappings' -d '{
      "_meta": {
       "created_by": "15.4.0"
      }
    }'
  4. Refresh the page
  5. You now should see the warning
  6. Execute
    curl -H 'Content-type: application/json' -XPOST 'http://localhost:9200/gitlab-development/_mappings' -d '{
      "_meta": {
       "created_by": "15.5.0-pre"
      }
    }'
  7. Refresh the page
  8. Warning should disappear

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 #346914 (closed)

Edited by Dmitry Gruzd

Merge request reports