Skip to content

Consolidate Elasticsearch application settings into one JSON field

Description

This consolidates (most of the) Elasticsearch application settings into one JSONB field.

We are migrating 21 columns and skipping the following Elasticsearch columns:

  • elasticsearch_url - because we have multiple errors moving this field. !174529 (closed) tried to solve this, but we still have CI errors that we cannot reproduce locally.
  • 4 encrypted_elasticsearch_* - because they use attr_encrypted gem. We are unsure if both accessors are compatible and want to minimize the risk.

Database migrations

It includes three database migrations:

  1. Migration to add the elasticsearch JSONB column
  2. Migration to copy the values from the different columns into the newly created column
  3. Post-migration to remove the original columns

Testing

Steps to test these changes:

  1. Run the database migrations: rails db:migrate
  2. Add a License http://localhost:3000/admin/application_settings/general#js-add-license-toggle
  3. Test/Modify the Elasticsearch settings http://localhost:3000/admin/application_settings/advanced_search#js-elasticsearch-settings
  4. Review the database data with rails console by running ApplicationSetting.current_without_cache.elasticsearch

Related to #500267 (closed)

Edited by Arturo Herrero

Merge request reports

Loading