Setting unique identifiers for Qdrant points in n8n

I’m struggling with inserting points into Qdrant using n8n. The problem is that my documents keep getting duplicated every time I insert them. I know Qdrant should replace points if they have the same ID, but I can’t figure out how to set the ID for points in n8n.

I tried adding an ID in the metadata, but that doesn’t seem to be the actual point ID that Qdrant uses. Does anyone know how to properly set up unique identifiers for Qdrant points when using n8n? I really need to avoid these duplicates.

Here’s a simplified example of what I’m trying to do:

const pointData = {
  vector: [0.1, 0.2, 0.3],
  payload: { title: 'Example Document' },
  metadata: { docId: '12345' }
};

// How do I set the actual Qdrant point ID here?
qdrantNode.upsertPoint(pointData);

Any help would be greatly appreciated!

Having experimented with Qdrant and n8n for a while, I eventually discovered that relying on a generated unique identifier during each insertion was the best strategy to prevent duplicates. Rather than reusing metadata values, I create an identifier using the current timestamp combined with a random string. This guarantees a truly unique ID for each entry. When you insert a point with this unique ID, Qdrant updates existing data or adds new records accordingly, eliminating the issue of duplicated entries altogether.

hey samuel87, i’ve been there! for qdrant in n8n, u gotta set the ‘id’ field directly in the point data. like this:

const pointData = {
  id: '12345',
  vector: [0.1, 0.2, 0.3],
  payload: { title: 'Example Document' }
};

this way qdrant’ll use that id to replace existing points. hope it helps!

I encountered a similar issue when working with Qdrant and n8n. The solution lies in properly setting the ‘id’ field as part of the point data structure. Here’s how you can modify your code to achieve this:

const pointData = {
  id: '12345', // This is the crucial line
  vector: [0.1, 0.2, 0.3],
  payload: { title: 'Example Document' },
  metadata: { docId: '12345' }
};

qdrantNode.upsertPoint(pointData);

By including the ‘id’ field directly in the pointData object, Qdrant will use this identifier to update existing points or insert new ones, effectively preventing duplicates. Ensure that your ‘id’ values are unique across your dataset for optimal results.