ElasticSearch Configuration location

Hey Everyone

We’re using Gitlab EE v 13.3 and we are trying to enable ElasticSearch. I read the documentation and it has “Advance Configuration Options” that we want to tinker further. I understand that these setting are available from Admin Area > Settings > General portion of the Gitlab website.

Are these config settings also available on either gitlab.rb or any other config file that Gitlab EE uses? Reason being is that we want to capture these setting on our Configuration management tool and store it on our VCS

Thanks for the help (in advance)!

The config files only carry settings required by GitLab’s startup/upgrade/init procedures that need to configure independent services and certain global values. Actual feature settings are controlled through database entries and exposed over the UI, the API, and also the ORM layer (through console).

For change-keeping, you can consider keeping a list of Ruby scripts to pass to GitLab Rails Runner, or scripted REST API calls to the Application Settings endpoint using a HTTP client of choice (curl, etc.).

An example for each, modifying the Number of Elasticsearch shards Advanced Search configuration:

  • Ruby:
# Write
ApplicationSetting.current.update_attributes(elasticsearch_shards: 5)

# Read/Check
ApplicationSetting.current.elasticsearch_shards
  • API:
curl \
  --header 'PRIVATE-TOKEN: <your_access_token>' \
  --request PUT \
  'https://gitlab.example.com/api/v4/application/settings?elasticsearch_shards=5'