Skip to content

Commit ef8378a

Browse files
committed
Use action: upsert for backfill
1 parent 5715012 commit ef8378a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

functions/src/backfill.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ module.exports = functions.firestore.document(config.typesenseBackfillTriggerDoc
7878

7979
lastDoc = thisBatch.docs.at(-1) ?? null;
8080
try {
81-
await typesense.collections(encodeURIComponent(config.typesenseCollectionName)).documents().import(currentDocumentsBatch);
81+
await typesense.collections(encodeURIComponent(config.typesenseCollectionName)).documents().import(currentDocumentsBatch, { action: 'upsert' });
8282
functions.logger.info(`Imported ${currentDocumentsBatch.length} documents into Typesense`);
8383
} catch (error) {
8484
functions.logger.error(`Import error in a batch of documents from ${currentDocumentsBatch[0].id} to ${lastDoc.id}`, error);

0 commit comments

Comments
 (0)