WXPNG opened a new pull request, #13003:
URL: https://github.com/apache/seatunnel/pull/13003

   ## Purpose
   
   Fixes #12704: the Elasticsearch/OpenSearch sink generates a colliding 
document `_id` for composite primary keys when a key value contains the 
`key_delimiter` (default `_`), silently overwriting documents.
   
   ## Approach
   
   Reuses the opt-in `key_encoding` option introduced in #12839 
(Easysearch/Typesense) and applies it to the Elasticsearch/OpenSearch shared 
serialization path:
   
   - `key_encoding = LEGACY` (default): keeps the existing delimiter-joined 
`_id`, fully backward compatible.
   - `key_encoding = LENGTH_PREFIXED`: encodes each composite key value as 
`<length>:<value>` (e.g. `["1_1", "2"]` -> `3:1_11:2`, `["1", "1_2"]` -> 
`1:13:1_2`), avoiding collisions. Single primary keys keep their existing IDs.
   
   ## Changes
   
   - Add `KeyEncoding` enum and `key_encoding` option.
   - Extend `KeyExtractor` to support `LENGTH_PREFIXED` encoding (legacy path 
unchanged).
   - Wire the option through `IndexInfo` / `ElasticsearchRowSerializer` / 
`ElasticsearchSinkFactory`.
   - Add `KeyExtractorTest` covering collision tuples, exact legacy default 
IDs, single primary key, and null values.
   - Update EN/ZH connector docs with the new option and migration note.
   
   ## Verification
   
   - `KeyExtractorTest` + `ElasticsearchRowSerializerTest`: 9 tests pass.
   - `spotless:check` passes.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to