Apply position index_options on Elasticsearch cluster to save disk space
Below are the tasks we need to do in order to take advantage of Elasticsearch storage optimization that we implemented in !25992 (merged)
-
Change index_options to positions
on staging. -
Change index_options to positions
on production. -
Test Elasticsearch index data migration on staging and have a runbook for process -
Migrate the data on production. -
Update documentation to guide self-managed customers on how to change this setting and describe how they can re-index to get the full storage savings.
Command to change index_options
curl -XPUT -H 'Content-Type: application/json' 'http://localhost:9200/gitlab-development/_mappings' -d '{
"properties": {
"title": {
"type": "text",
"index_options": "docs"
},
"description": {
"type": "text",
"index_options": "positions"
},
"target_branch": {
"type": "text",
"index_options": "docs"
},
"source_branch": {
"type": "text",
"index_options": "docs"
},
"note": {
"type": "text",
"index_options": "positions"
},
"name": {
"type": "text",
"index_options": "docs"
},
"path": {
"type": "text",
"index_options": "docs"
},
"name_with_namespace": {
"type": "text",
"index_options": "docs",
"analyzer": "my_ngram_analyzer"
},
"path_with_namespace": {
"type": "text",
"index_options": "positions"
},
"file_name": {
"type": "text",
"index_options": "docs"
},
"content": {
"type": "text",
"index_options": "positions"
},
"blob": {
"properties": {
"id": {
"type": "text",
"index_options": "docs",
"analyzer": "sha_analyzer"
},
"oid": {
"type": "text",
"index_options": "docs",
"analyzer": "sha_analyzer"
},
"commit_sha": {
"type": "text",
"index_options": "docs",
"analyzer": "sha_analyzer"
},
"content": {
"type": "text",
"index_options": "positions",
"analyzer": "code_analyzer",
"search_analyzer": "code_search_analyzer"
}
}
},
"commit": {
"properties": {
"id": {
"type": "text",
"index_options": "docs",
"analyzer": "sha_analyzer"
},
"sha": {
"type": "text",
"index_options": "docs",
"analyzer": "sha_analyzer"
},
"author": {
"properties": {
"email": {
"type": "text",
"index_options": "docs"
},
"name": {
"type": "text",
"index_options": "docs"
}
}
},
"committer": {
"properties": {
"email": {
"type": "text",
"index_options": "docs"
},
"name": {
"type": "text",
"index_options": "docs"
}
}
},
"message": {
"type": "text",
"index_options": "positions"
}
}
}
}
}'
Edited by Dylan Griffith