Skip to content

[feat][elasticsearch] Add hashed id support - #15428

Merged
nicoloboschi merged 2 commits into
apache:masterfrom
nicoloboschi:es-sink-hashed-id
Jun 10, 2022
Merged

nicoloboschi merged 2 commits into
apache:masterfrom
nicoloboschi:es-sink-hashed-id

Conversation

@nicoloboschi

Copy link
Copy Markdown
Contributor

Motivation

ElasticSearch has a size limitation for the document id. The hard limit is 512 bytes. It is not configurable.

_id is limited to 512 bytes in size and larger values will be rejected.
https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-id-field.html

In order to by-pass this limitation without losing data integrity and uniqueness a new option is introduced to create an hash of the Pulsar record key.

Modifications

  • New option idHashingAlgorithm, enum NONE, SHA256, SHA512
  • For the hashing computation we use Guava utility class com.google.common.hash.Hashing

Note that this option will add a CPU overhead in order to compute the hashed value.
It is suggested to use this option together with canonicalKeyFields in order to guarantee the same hashed value for the same key content regardless the key fields order. (#15426)

  • 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 May 4, 2022
Comment thread site2/docs/io-elasticsearch-sink.md Resolved
Comment thread site2/docs/io-elasticsearch-sink.md Resolved
nicoloboschi added a commit to datastax/pulsar that referenced this pull request May 10, 2022
* [feat][elasticsearch] Add hashed id support

* add config default test

(cherry picked from commit 06dd182)
@nicoloboschi

Copy link
Copy Markdown
Contributor Author

@lhotari @dlg99 @eolivelli PTAL

@nicoloboschi nicoloboschi added this to the 2.11.0 milestone May 23, 2022
@nicoloboschi

Copy link
Copy Markdown
Contributor Author

/pulsarbot rerun-failure-checks

@nicoloboschi

Copy link
Copy Markdown
Contributor Author

/pulsarbot rerun-failure-checks

* [feat][elasticsearch] Add hashed id support

* add config default test
@nicoloboschi

Copy link
Copy Markdown
Contributor Author

/pulsarbot rerun-failure-checks

@nicoloboschi
nicoloboschi merged commit 6722417 into apache:master Jun 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/connector 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.

5 participants