question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding documents with primary key not working

See original GitHub issue

When adding documents and including a primary key, the primary key is getting set to None instead of the specified key. For example:

index.add_documents(small_movies, primary_key="title")
print(index.get_primary_key())

results in None being printed. Maybe I’m just not correctly understanding how to use the primary_key? The correct url of indexes/some-uid/documents?primaryKey=title is being generated. so the add_documents method seem to be doing what it is supposed to do.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
bidoubiwacommented, Mar 9, 2021

I think it may be because of restricted characters on primary keys https://docs.meilisearch.com/learn/core_concepts/documents.html#primary-field

1reaction
bidoubiwacommented, Mar 2, 2021

This actually brings up another point that confused me with update_documents. It takes primary_key as a parameter, but the primary key can’t be updated. So does that mean update_documents should not accept a primary key?

~Yes this should be removed!~

Actually if you look at the get_primary_key() method the only thing it does is call fetch_info()

Ah, you’re right, my bad. I will take a closer look tomorrow 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Document field as primary key not working - Stack Overflow
The problem is that Spring Data JPA, when you call Repository#save , assumes that you want to update an existing entity when the...
Read more >
Does not allow adding Primary key to a restored database.
So we basically have data in the database that is not in the backup. I do an import for the database(backup). It errored...
Read more >
"Violation of PRIMARY KEY constraint... Cannot insert ...
Solution / Workaround. To solve the issue, your SQL Server should be updated with latest updates from Microsoft and M-Files Server service ...
Read more >
Postgresql 14 Primary Key not working, allows duplicates
primary key is allowing duplicates! Then I created new unique index and replace the current one, and the problem still exists, how is...
Read more >
Error: Non-Unique value/primary key (or sql_distinct_key ...
Quick fix. To resolve this problem, add the primary key from view B to the problem measure with the sql_distinct_key parameter.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found