@@ -13,19 +13,21 @@ GitLab leverages the search capabilities of Elasticsearch and enables it when
searching in:
- GitLab application
- issues
- merge requests
- milestones
- notes
- projects
- repositories
- snippets
- wiki repositories
Once the data is added to the database or repository, search indexes will be updated
automatically. Elasticsearch can be installed on the same machine that GitLab
- Issues
- Merge requests
- Milestones
- Notes
- Projects
- Repositories
- Snippets
- Wiki
Once the data is added to the database or repository and [Elasticsearch is enabled in the admin area](#enable-elasticsearch) the search index will be updated
automatically.
Elasticsearch can be installed on the same machine that GitLab
is installed or on a separate server.
## Requirements
These are the minimum requirements needed for Elasticsearch to work:
...
...
@@ -33,6 +35,7 @@ These are the minimum requirements needed for Elasticsearch to work:
- GitLab 8.4+
- Elasticsearch 2.4.x (with [Delete By Query Plugin](https://www.elastic.co/guide/en/elasticsearch/plugins/2.4/plugins-delete-by-query.html) installed)
## Install Elasticsearch
Elasticsearch is _not_ included in the Omnibus packages. You will have to
...
...
@@ -43,6 +46,7 @@ is out of the scope of this document.
You can follow the steps as described in the [official web site][install] or
use the packages that are available for your OS.
## Enable Elasticsearch
In order to enable Elasticsearch you need to have access to the server that GitLab is hosted on, and an administrator account on your GitLab instance. Go to **Admin > Settings** and find the "Elasticsearch" section.
...
...
@@ -57,6 +61,7 @@ The following Elasticsearch settings are available:
| `Port` | The TCP port that Elasticsearch listens to. The default value is 9200 |
## Add GitLab's data to the Elasticsearch index
Configure Elasticsearch's host and port in **Admin > Settings**. Then create empty indexes using one of the following commands:
...
...
@@ -70,14 +75,7 @@ Configure Elasticsearch's host and port in **Admin > Settings**. Then create emp
If you need to update any outdated indexes, you can use
the `UPDATE_INDEX` parameter:
Sometimes your repository index process `gitlab:elastic:index_repositories` get interupted due to various reasons, in this case you can safely run it again and it will skip those repositories that already have been indexed. As the indexer stores the last commit SHA of every indexed repository in the database you can run the indexer with the special parameter `UPDATE_INDEX` and it will check every project repository again to make sure that every commit in that repository is indexed, it can be useful in case if your index is outdated:
Disabling the Elasticsearch integration is as easy as unchecking `Search with Elasticsearch enabled` and `Elasticsearch indexing` in **Admin > Settings**.
## Special recommendations
Here are some tips to use Elasticsearch with GitLab more efficiently.
### Indexing large repositories
Indexing large Git repositories can take a while. To speed up the process, you
can temporarily disable auto-refreshing. In our experience you can expect a 20%
can temporarily disable auto-refreshing and replicating. In our experience you can expect a 20%
time drop.
1. Disable refreshing:
...
...
@@ -172,7 +170,7 @@ time drop.
} }'
```
1.(optional) You may want to disable replication and enable it after indexing:
1.Disable replication and enable it after indexing:
```bash
curl --request PUT localhost:9200/_settings --data '{
...
...
@@ -183,7 +181,7 @@ time drop.
1.[Create the indexes](#add-gitlabs-data-to-the-elasticsearch-index)
1.(optional) If you disabled replication in step 2, enable it after
1.Enable replication again after
the indexing is done and set it to its default value, which is 1:
son":"Can't specify parent if no parent field has been configured"},"status":400}):
```
This is because we changed the index mapping in GitLab 8.12 and the old indexes should be removed and build from scratch again,
This is because we changed the index mapping in GitLab 8.12 and the old indexes should be removed and built from scratch again,
see details in the [8-11-to-8-12 update guide](https://gitlab.com/gitlab-org/gitlab-ee/blob/master/doc/update/8.11-to-8.12.md#11-elasticsearch-index-update-if-you-currently-use-elasticsearch).