Commit f38beb82 authored by Achilleas Pipinellis's avatar Achilleas Pipinellis

Refactor Elasticsearch documentation

[ ci skip]
parent 9c42e1d1
......@@ -77,6 +77,7 @@
- [Downgrade back to CE](downgrade_ee_to_ce/README.md) Follow this guide if you need to downgrade from EE to CE.
- [Git LFS configuration](workflow/lfs/lfs_administration.md)
- [GitLab Pages configuration](pages/administration.md)
- [Elasticsearch (EE-only)](integration/elasticsearch.md) Enable Elasticsearch
## Contributor documentation
......
# Elasticsearch integration
If you want to make your GitLab search really powerful you can get it use the Elasticsearch.
_**Note:** This feature was [introduced][ee-109] in GitLab EE 8.4._
Elasticsearch is a flexible, scalable and powerful search service. It will keep to be a fast even with huge amount of data. We use elasticsearch to search through a merge requests, issues, notes, wiki, code and commits. Once the data is added to the database it will update search index automatically.
---
1. Install elasticsearch as described in the [official web site](https://www.elastic.co/products/elasticsearch). The packages are also available on different platforms.
[Elasticsearch] is a flexible, scalable and powerful search service.
1. On your GitLab server, open the configuration file.
If you want to keep GitLab's search fast when dealing with huge amount of data,
you should consider [enabling Elasticsearch](#enable-elasticsearch).
For omnibus package:
GitLab leverages the search capabilities of Elasticsearch and enables it when
searching in:
```sh
sudo editor /etc/gitlab/gitlab.rb
```
- GitLab application
- issues
- merge requests
- milestones
- notes
- projects
- repositories
- snippets
- wiki repositories
For installations from source:
Once the data is added to the database, search indexes will be updated
automatically. Elasticsearch can be installed on the same machine that GitLab
is installed or on a separate server.
```sh
cd /home/git/gitlab
## Install Elasticsearch
sudo -u git -H editor config/gitlab.yml
```
Providing detailed information on installing Elasticsearch is out of the scope
of this document.
1. Add the elastic search configuration:
You can follow the steps as described in the [official web site][install] or
use the packages that are available for your OS.
For omnibus package:
## Enable Elasticsearch
```ruby
gitlab_rails['elasticsearch'] = [
{
"enabled" => "true",
"host" => "localhost",
"port" => 9200
}
]
```
In order to enable Elasticsearch you need to have access to the server that
GitLab is hosted on.
For installation from source:
The following three parameters are needed to enable Elasticsearch:
```
elasticsearch:
enabled: true
host: localhost
port: 9200
```
| Parameter | Description |
| --------- | ----------- |
| `enabled` | Enables/disables the Elasticsearch integration. Can be either `true` or `false` |
| `host` | The host where Elasticsearch is installed on. Can be either an IP or a domain name which correctly resolves to an IP. It can be changed in the [Elasticsearch configuration settings][elastic-settings]. The default value is `localhost` |
| `port` | The TCP port that Elasticsearch listens to. It can be changed in the [Elasticsearch configuration settings][elastic-settings]. The default value is `9200` |
### Enable Elasticsearch in Omnibus installations
Chose you own configuration parameters.
If you have used one of the [Omnibus packages][pkg] to install GitLab, all
you have to do is edit `/etc/gitlab/gitlab.rb` and add the following lines:
1. Save the configuration file.
```ruby
gitlab_rails['elasticsearch'] = [
{
"enabled" => "true",
"host" => "localhost",
"port" => 9200
}
]
```
1. Restart GitLab for the changes to take effect.
Replace the values as you see fit according to the
[settings table above](#enable-elasticsearch).
1. And the last step it to index everything by running special rake tasks.
To index all your repositories you should run following tasks:
Save the file and reconfigure GitLab for the changes to take effect:
`sudo gitlab-ctl reconfigure`.
```
# omnibus installations
sudo gitlab-rake gitlab:elastic:index_repositories
As a last step, move on to
[add GitLab's data to the Elasticsearch index](#add-gitlabs-data-to-the-elasticsearch-index).
# installation from source
bundle exec rake gitlab:elastic:index_repositories RAILS_ENV=production
```
### Enable Elasticsearch in source installations
Keep in mind that it will take a while depending on how huge your git repos are.
If you have installed GitLab from source, edit `/home/git/gitlab/config/gitlab.yml`:
To index all wikis:
```yaml
elasticsearch:
enabled: true
host: localhost
port: 9200
```
```
# omnibus installations
sudo gitlab-rake gitlab:elastic:index_wikis
Replace the values as you see fit according to the
[settings table above](#enable-elasticsearch).
# installation from source
bundle exec rake gitlab:elastic:index_wikis RAILS_ENV=production
```
Save the file and restart GitLab for the changes to take effect:
`sudo service gitlab restart`.
To index all database entities:
As a last step, move on to
[add GitLab's data to the Elasticsearch index](#add-gitlabs-data-to-the-elasticsearch-index).
```
# omnibus installations
sudo gitlab-rake gitlab:elastic:index_database
## Add GitLab's data to the Elasticsearch index
# installation from source
bundle exec rake gitlab:elastic:index_database RAILS_ENV=production
```
After [enabling Elasticsearch](#enable-elasticsearch), you must run some
special rake tasks to add GitLab's data to the Elasticsearch index.
That's it. Enjoy you powerful search.
\ No newline at end of file
The following actions might take a while depending on how big your Git
repositories are.
---
To index all your repositories:
```
# omnibus installations
sudo gitlab-rake gitlab:elastic:index_repositories
# installations from source
bundle exec rake gitlab:elastic:index_repositories RAILS_ENV=production
```
To index all wikis:
```
# omnibus installations
sudo gitlab-rake gitlab:elastic:index_wikis
# installations from source
bundle exec rake gitlab:elastic:index_wikis RAILS_ENV=production
```
To index all database entities:
```
# omnibus installations
sudo gitlab-rake gitlab:elastic:index_database
# installations from source
bundle exec rake gitlab:elastic:index_database RAILS_ENV=production
```
## Disable Elasticsearch
Disabling the Elasticsearch integration is as easy as setting `enabled` to
`false` in your GitLab settings. See [Enable Elasticsearch](#enable-elasticsearch)
to find where those settings are and don't forget to reconfigure/restart GitLab
for the changes to take effect.
[ee-109]: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/109 "Elasticsearch Merge Request"
[elasticsearch]: https://www.elastic.co/products/elasticsearch "Elasticsearch website"
[install]: https://www.elastic.co/guide/en/elasticsearch/reference/current/_installation.html "Elasticsearch installation documentation"
[pkg]: https://about.gitlab.com/downloads/ "Download Omnibus GitLab"
[elastic-settings]: https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-configuration.html#settings "Elasticsearch configuration settings"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment