How to configure Gitlab Advanced Search

Powering up search in Gitlab

Sebastiaan avatar
  • Sebastiaan
  • 2 min read

Docker-compose elastic setup

This guide is based on docker-compose setup from elasticsearch. https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html

Add the Elastic IP

Add the IP and DNS from docker host to Gitlab.

vi /etc/hosts
<self specific ip> < DNS name like: test0.internal test1.internal test2.internal>

Add Elastic CA certificate

Add the CA certificate to /etc/gitlab/trusted-certs (give it a logical name) This CA file can be found on the docker host in the mapped data location.

Run Gitlab reconfigure

The reconfigure will add the CA to gitlab internally.

gitlab-ctl reconfigure

This will make a specific hash symlink in another gitlab folder.

/opt/gitlab/embedded/ssl/certs

This will show if openssl can make a connection to the Elasticsearch cluster

echo | /opt/gitlab/embedded/bin/openssl s_client -connect test0.internal:9200

With the symlink in place we can configure through the GUI the connection to Elasticsearch cluster with https://test0.internal:9200 with username and password.

Rate Limiting change

The default rate limit is set to 30, when using advanced search the rate limit will be triggerd per minute. Through the following change we set the new default to 1000. This can be set through following path in UI: admin portal > settings > Network > Search rate limits

Indexing shard sizing

Through the GUI we can setup our Shard sizing, after testing 1 shard and 1 replica is more then enough for our needs.

Indexing

Input parameters for connection; url: https://test0.internal:9200 Username: elastic Password: Configured Password

Enable setting “Elasticsearch indexing”, Press the blue button on top off the page to start the indexing from all the projects. Progress can be found throughout the CLI commands below;

Enable setting “Search with Elasticsearch enabled”

Nice to know commands

Create and recreate index for Elastic through gitlab-rake

gitlab-rake gitlab:elastic:create_empty_index
gitlab-rake gitlab:elastic:recreate_index

Index information

gitlab-rake gitlab:elastic:projects_not_indexed
gitlab-rake gitlab:elastic:index_projects
gitlab-rake gitlab:elastic:index_projects_status

Gitlab Elastic main overview

gitlab-rake gitlab:elastic:info
Sebastiaan

Written by : Sebastiaan

Sysadmin/Platform/Devops Engineer

Recommended for You

How to reindex Gitlab Advanced_search

How to reindex Gitlab Advanced_search

A quick way to reindex search

How to do a Gitlab Major version upgrade

How to do a Gitlab Major version upgrade

Easy way to upgrade to a newer version.