Setting unique identifiers for Qdrant points in n8n

I’m having trouble figuring out how to assign IDs to Qdrant points when using n8n. The Qdrant docs say that points with the same ID will be replaced, which is what I want. But I can’t find a way to set the point ID in n8n.

I tried putting the ID in the metadata, but that’s not the same as the actual point ID. This is causing problems because every time I insert the same document, it creates a duplicate instead of replacing the existing one.

Has anyone successfully set point IDs for Qdrant in n8n? I’d really appreciate some guidance on how to do this correctly. It would help me avoid creating duplicate entries and make my workflow much more efficient.

Thanks in advance for any help!

I’ve encountered this issue in my projects as well. One effective solution I found is using the ‘Upsert’ operation in the Qdrant node. This operation allows you to specify an ID for each point, which is crucial for your use case.

When configuring the Qdrant node, select ‘Upsert’ as the operation. Then, in the ‘Points’ field, structure your data to include an ‘id’ key for each point. This ID should be a unique identifier for your document. Qdrant will use this ID to replace existing points or insert new ones if they don’t exist.

Here’s a basic structure I’ve used:

{
id: ‘{{$json.uniqueDocumentId}}’,
payload: { your_data_here },
vector: [your_vector_here]
}

This approach has consistently worked for me, preventing duplicates and ensuring efficient updates. Just ensure your unique identifier remains consistent for each document across insertions.

I’ve dealt with this exact problem in my own n8n workflows. What worked for me was using the ‘Set’ operation in the Qdrant node instead of ‘Insert’. With ‘Set’, you can specify a ‘points’ array where each point object includes an ‘id’ field. Map your unique identifier to this ‘id’ field, and Qdrant will replace existing points with matching IDs.

For example, your point object might look like:

{
  id: '{{$json["uniqueId"]}}',
  payload: { ... },
  vector: [ ... ]
}

This approach ensures that each document gets a unique ID, preventing duplicates and allowing for easy updates. It took some trial and error to get it right, but it’s been working smoothly for me ever since. Just make sure your ‘uniqueId’ is consistent across insertions for the same document.

hey there, i’ve run into this issue before. the trick is to use the ‘upsert’ option in n8n’s qdrant node. it lets u specify an ID field. just map ur desired ID to that field and it’ll replace existing points instead of duplicating. hope this helps!