toluaina/pgsync

Support for specifying custom keys to use for document _id

4d11 opened this issue · 2 comments

4d11 commented

PGSync version: 2.5.0

Postgres version: 15

Elasticsearch version: 7.8.0

Redis version: ..

Python version: 3.9.6

Problem Description:
Is it feasible to add support for using custom _ids instead of using the table's specified ones. I have a use case where the table's primary keys are (item_id, item_version). I would like to only have the latest version of the record indexed in Elasticsearch while keeping older versions as a record in postgres. Specifying the _id as (item_id) would achieve this behaviour.

I will happy to pick up this task if there is no existing method

Error Message (if any):



Did you solve this issue? I too need the ability to generate a custom _id but don't want to duplicate your work if you've already done it.

Sorry, I'm late to respond to this. Custom primary keys are not supported.
However, pgsync already handles composite primary keys so you don't have to do this.
The _id is a concatenation of all primary keys on the table