Skip to content

[pulsar-io] Elasticsearch sink support for Elastic 8 - #14805

Merged
lhotari merged 1 commit into
apache:masterfrom
nicoloboschi:es8-support
Apr 1, 2022
Merged

lhotari merged 1 commit into
apache:masterfrom
nicoloboschi:es8-support

Conversation

@nicoloboschi

Copy link
Copy Markdown
Contributor

Motivation

OpenSearch high-level rest api client does not support Elastic 8 servers.
There are some hardcoded request fields that are no longer supported in ES 8 and the server throws an error. (Full guide). For the ES Sink usage the first problem I found was about createIndex request for the field "type" (include_type_name in request, type in responses).

Elastic has a guide to softly migrate to newer installation using custom http headers.
We are using OpenSearch client which doesn't support "application/vnd.elasticsearch+json;compatible-with=7" content-type.

The best solution is to migrate from high-level rest client to the official Elastic java client which is Apache 2 licensed.
See the License page

Update: The Java HLRC has been deprecated in 7.15.0 in favor of the Java API Client. The Java API Client is licensed under Apache 2.0.

Elastic java-client is not compatible with OpenSearch.
The solution is to keep both the client (opensearch high-level and elastic java-client) and use the proper one based on the target server.

Modifications

  • Added a new configuration property: compatibilityMode that accepts:
    • AUTO (default): it will discover the server version and choose the right client implementation
    • ELASTICSEARCH: Force to use the ES java client
    • ELASTICSEARCH_7: Force to use OpenSearch client. It's better to use the OpenSearch implementation for ES7 since it is more "tested" in production and it is the current implementation. (that's a conservative choice to avoid regression while upgrading Pulsar)
    • OPENSEARCH: Force to use OpenSearch client
  • Created a new interface RestClient with the two different implementations.
  • Created a new BulkProcessor API (very similar to the HighLevel rest API client one) to handle bulk requests with the following features:
    • Multi-thread async requests
    • Threshold based on number of operations
    • Threshold based on byte sizes of operations
    • Periodic auto flush
  • Moved all the tests (both unit and integration) that are using the container to run with both ES 7,ES 8 and OpenSearch docker containers.

Verifying this change

  • Make sure that the change passes the CI checks.

This change is already covered by existing tests, such as (please describe tests).

  • tests under pulsar-io/elastic-search
  • Pulsar Sink integration tests

Documentation

  • doc

@github-actions github-actions Bot added the doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. label Mar 22, 2022
@nicoloboschi nicoloboschi reopened this Mar 24, 2022
@nicoloboschi

Copy link
Copy Markdown
Contributor Author

/pulsarbot rerun-failure-checks

@eolivelli eolivelli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nicoloboschi

Copy link
Copy Markdown
Contributor Author

/pulsarbot rerun-failure-checks

@dlg99 dlg99 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@nicoloboschi

Copy link
Copy Markdown
Contributor Author

/pulsarbot rerun-failure-checks

@nicoloboschi

Copy link
Copy Markdown
Contributor Author

@nicoloboschi

Copy link
Copy Markdown
Contributor Author

the failing check is not related to this pull

@nicoloboschi

Copy link
Copy Markdown
Contributor Author

/pulsarbot rerun-failure-checks

@nicoloboschi

Copy link
Copy Markdown
Contributor Author

@lhotari could you please explain to me how to rerun the failed job? I can't find the button

@lhotari

lhotari commented Apr 1, 2022

Copy link
Copy Markdown
Member

@lhotari could you please explain to me how to rerun the failed job? I can't find the button

The workflow needs to finish before it's possible to rerun failed jobs. That seems to be a limitation compared to the previous solution. The button to rerun failed jobs is only visible to Pulsar committers. For others, it's possible to use /pulsarbot rerun-failure-checks after the workflow has completed.
Yesterday GitHub Actions build queue was very long so that caused delays. When there aren't queues, the workflow finishes in about 1h 20minutes.

@nicoloboschi

Copy link
Copy Markdown
Contributor Author

/pulsarbot rerun-failure-checks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Your PR contains doc changes, no matter whether the changes are in markdown or code files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants