Fix mappings errors for ES6.8
Background
Elasticsearch 6 still supported mapping types (see: https://www.elastic.co/guide/en/elasticsearch/reference/current/removal-of-types.html).
Zendesk ticket (GitLab team member access only): https://gitlab.zendesk.com/agent/tickets/278509
A customer reported being unable to process Advanced Search migrations while running ES version 6.8
The error returned suggested an issue with the mapping type (which is only supported in ES version 6.8)
{"severity":"ERROR","time":"2022-04-20T13:00:02.955Z","correlation_id":"bb95bc33d393598d40f4ca69ed09a976","message":"Elastic::MigrationWorker: Elasticsearch::Transport::Transport::Errors::BadRequest [400] {\"error\":{\"root_cause\":[{\"type\":\"action_request_validation_exception\",\"reason\":\"Validation Failed: 1: mapping type is missing;\"}],\"type\":\"action_request_validation_exception\",\"reason\":\"Validation Failed: 1: mapping type is missing;\"},\"status\":400}"}
What does this MR do and why?
- change the
put_mapping
andget_mapping
helper methods to properly support Elasticsearch version 6.8 - add specs to cover
get_mapping
method
⚠ Note ⚠
- This will be removed in %15.0 as we transition to a new Elasticsearch client but we would like to backport this to the previous 3 releases.
- This MR blocks:
- ES client upgrade: !79949 (merged)
- Advanced Search migration deprecation: !83937 (merged)
Screenshots or screen recordings
N/A
How to set up and validate locally
- Ensure that Elasticsearch and Advanced Search is enabled in your gdk
- run a docker container with ES version 6.8:
docker run --rm --name es6.8 -p 9201:9200 -p 9301:9300 -it elasticsearch:6.8.23 bin/elasticsearch -Ediscovery.type=single-node
- checkout master branch
- run the specs using the URL for the docker instance of ES:
ELASTIC_URL='http://192.168.205.5:9201' be rspec ee/spec/elastic/migrate/
(note that the URL you use may change depending on how you have docker setup) - the tests should fail with similar errors
- checkout this branch
- run the specs using the URL for the docker instance of ES:
ELASTIC_URL='http://192.168.205.5:9201' be rspec ee/spec/elastic/migrate/
(note that the URL you use may change depending on how you have docker setup) - the tests should pass
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Terri Chu