Skip to content

QdrantLocal client doesn't handle batched "set payload" operations with the "key" parameter correctly. #974

@fredtcaroli

Description

@fredtcaroli

I wanted to use QdrantLocal on some unit tests but realized it can't really handle my use-case corectly.

I am using Python's qdrant_client version 1.14.2.

How to reproduce

import qdrant_client
import qdrant_client.models as qdrant_models


COLLECTION_NAME = "default"

client = qdrant_client.QdrantClient(":memory:")

client.create_collection(
    collection_name=COLLECTION_NAME,
    vectors_config=qdrant_models.VectorParams(
        size=3, distance=qdrant_models.Distance.COSINE
    ),
)

client.upsert(
    collection_name=COLLECTION_NAME,
    points=[
        qdrant_models.PointStruct(
            id=1,
            vector=[1, 2, 3],
            payload={
                "metadata": {"version": 1, "hash": "abc"},
                "content": "some content",
            },
        )
    ],
)

client.batch_update_points(
    collection_name=COLLECTION_NAME,
    update_operations=[
        qdrant_models.SetPayloadOperation(
            set_payload=qdrant_models.SetPayload(
                payload={
                    "version": 2,
                },
                points=[1],
                key="metadata",
            )
        )
    ],
)

records, _ = client.scroll(collection_name=COLLECTION_NAME)

print(records)

Expected Output

[Record(id=1, payload={'metadata': {'version': 2, 'hash': 'abc'}, 'content': 'some content'}, vector=None, shard_key=None, order_value=None)]

Actual Output

[Record(id=1, payload={'metadata': {'version': 1, 'hash': 'abc'}, 'content': 'some content', 'version': 2}, vector=None, shard_key=None, order_value=None)]

Non-Batched Operation Works as Intended

If I change the batch_update_points call for a non-batched call it works:

client.set_payload(
    collection_name=COLLECTION_NAME,
    payload={
        "version": 2,
    },
    points=[1],
    key="metadata",
)

This gives the right output, no problem. It's just the batched operation that is not being handled correctly.

Metadata

Metadata

Assignees

Labels

To be releasedMerged into dev, waiting for releasebugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions