Skip to content

Fix mappings errors for ES6.8

Terri Chu requested to merge tchu-fix-es6-mapping-migrations-errors into master

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 and get_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:

Screenshots or screen recordings

N/A

How to set up and validate locally

  1. Ensure that Elasticsearch and Advanced Search is enabled in your gdk
  2. 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
  3. checkout master branch
  4. 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)
  5. the tests should fail with similar errors
  6. checkout this branch
  7. 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)
  8. 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.

Edited by Terri Chu

Merge request reports