meilisearch / documentation

Meilisearch documentation

Home Page:https://docs.meilisearch.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Meilisync guides: Add note regarding primary key field

guimachiavelli opened this issue · comments

A user mentioned they ran into issues with using meilisync when their dataset contains several fields ending in _id:

[…] I had to add the pk (primary key) attribute to the tables in the config.yml because my tables have more than one column ending in 'id'. Note that the pk YAML attribute is not mentioned in the documentation, but the reported error suggests its existence.

Pinging @meilisearch/devrel-team, the official maintainers of the meilisync guides.

Tasks

  • verify with SME (@alallema) whether the info checks out and if this scenario also applies to PostgreSQL
  • update /learn/primary_db_sync/meilisync_mysql.mdx
  • if necessary, update /learn/primary_db_sync/meilisync_postgre.mdx

References

Indeed, if you have several fields with id in them, you'll get an index_primary_key_multiple_candidates_found error, at which point meilisync proposes a way to set the primary key field as it is:

sync:
--
  - table: POSTGRES_TABLE_NAME_1
    index: MEILISEARCH_INDEX_NAME_1
    pk: _id
    full: false

I just checked the meilisync code because the user is right this is not in the documentation

Thanks for the investigation @alallema.

Is this true for both Postgres and MySQL or only the latter?

@Strift, It's true for everyone