Skip to content

Draft: Upgrade rest-high-level client to 7.17 to support Elasticsearch 8.

Rustam Lotsmanenko (EPAM) requested to merge elastic-8-migration into master

Description:

Backward-compatible migration to Elastic 8 using client version 7.17.12: https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-high-compatibility.html

Removed types usage, they were deprecated, only default type _doc were left in v 7.* and completely removed in v.8.*: https://www.elastic.co/guide/en/elasticsearch/reference/7.17/removal-of-types.html

No changes are required from the client builder, thanks to the provided ELASTIC_CLIENT_APIVERSIONING=true environment variable that determines whether to send the 7.x compatibility header.

With these changes, Indexer is able to work with both ElasticSearch v7.* and v8.*.

How to test:

Functionality was tested via int tests simultaneously on both envs, with Elasticsearch 8 and Elasticsearch7.

Info endpoint example for two environments that run the same binaries, but different Elasticsearch versions:

curl --location 'https://community.gcp.gnrg-osdu.projects.epam.com/api/indexer/v2/info'
{
    "groupId": "org.opengroup.osdu.indexer",
    "artifactId": "indexer-gc",
    "version": "0.24.0-SNAPSHOT",
    "buildTime": "2023-08-31T14:11:53.626Z",
    "branch": "trusted-elastic-8-migration",
    "commitId": "88c77d0d6977a9d74c74492aa20c2d9ac995f11c",
    "commitMessage": "Merge remote-tracking branch 'origin/elastic-8-migration' into elastic-8-migration",
    "connectedOuterServices": [
        {
            "name": "Redis-RedisCacheBuilder$2",
            "version": "7.2.0"
        },
        {
            "name": "Redis-RedisCacheBuilder$2",
            "version": "7.2.0"
        },
        {
            "name": "Redis-RedisCacheBuilder$2",
            "version": "7.2.0"
        },
        {
            "name": "ElasticSearch-osdu",
            "version": "8.9.1"
        },
        {
            "name": "ElasticSearch-second",
            "version": "8.9.1"
        }
    ]
}

curl --location 'https://osdu.ref.gcp.gnrg-osdu.projects.epam.com/api/indexer/v2/info'
{
    "groupId": "org.opengroup.osdu.indexer",
    "artifactId": "indexer-gc",
    "version": "0.24.0-SNAPSHOT",
    "buildTime": "2023-08-31T11:31:25.185Z",
    "branch": "trusted-elastic-8-migration",
    "commitId": "88c77d0d6977a9d74c74492aa20c2d9ac995f11c",
    "commitMessage": "Merge remote-tracking branch 'origin/elastic-8-migration' into elastic-8-migration",
    "connectedOuterServices": [
        {
            "name": "Redis-RedisCacheBuilder$2",
            "version": "7.0.12"
        },
        {
            "name": "Redis-RedisCacheBuilder$2",
            "version": "7.0.12"
        },
        {
            "name": "Redis-RedisCacheBuilder$2",
            "version": "7.0.12"
        },
        {
            "name": "ElasticSearch-osdu",
            "version": "7.17.12"
        }
    ]
}

Changes include:

  • Refactor (a non-breaking change that improves code maintainability).
  • Bugfix (a non-breaking change that solves an issue).
  • New feature (a non-breaking change that adds functionality).
  • Breaking change (a change that is not backward-compatible and/or changes current functionality).

Changes in:

  • GCP
  • Azure
  • AWS
  • IBM
  • Common code

Dev Checklist:

  • Added Unit Tests, wherever applicable.
  • Updated the Readme, if applicable.
  • Existing Tests pass
  • Verified functionality locally
  • Self Reviewed my code for formatting and complex business logic.

Other comments:

Edited by Rustam Lotsmanenko (EPAM)

Merge request reports