Elasticsearch documentation feedback from GitLab.com experience
Hello!
I would like to mention some notes about this section on the Elasticsearch documentation after working on https://gitlab.com/gitlab-com/infrastructure/issues/2157
Index-level operations should reflect the index name
On points 1, 2, 4, 5
you have the following curl
command:
curl --request PUT localhost:9200/_settings --data '{
[...]
}'
The operations that are trying to be performed there (change index refresh interval on points 1, 4
and change number of replicas on points 2, 5
are index-related operations so you need to specify the index name where you want these settings to be applied.
Given that the name of the index created after running sudo gitlab-rake gitlab:elastic:create_empty_index
is gitlab-production
, the commands should look like:
curl --request PUT localhost:9200/gitlab-production/_settings --data '{
[...]
}'
curl
command to change the number of default shards (set to 5
) in case someone wants to:
Suggestion to have an extra If the amount of data expected to be indexed is quite large, you are probably going to use more than 5
shards, which is the default setting for Elasticsearch.
If the user would want to change the amount of shards prior to starting indexing data, there could be an extra step before creating the index reflecting this:
curl -s -XPUT localhost:9200/_template/gitlab-production --data '{
"template": "gitlab-production",
"settings": {
"number_of_shards": <desired_number_of_shards>
}
}'
Hope this helps! Thanks a lot