Skip to content

Upsert a point with existing id with empty payload behaves differently with rest and grpc #6449

@joein

Description

@joein

When upserting a point with empty payload and id of an existing point with non-empty payload, in rest point's payload is to {}, while in grpc its payload is preserved as it was

Here is a script to reproduce the issue and its output

from qdrant_client import QdrantClient, models

for prefer_grpc in (True, False):
    print('grpc' if prefer_grpc else 'http')

    cl = QdrantClient(prefer_grpc=prefer_grpc)
    if cl.collection_exists("test"):
        cl.delete_collection("test")

    cl.create_collection(
        "test", vectors_config=models.VectorParams(size=2, distance=models.Distance.COSINE)
    )
    cl.upsert(
        "test",
        points=[
            models.PointStruct(
                id=1,
                vector=[
                    0.5, 0.5
                ],
                payload={'a': 2},
            )
        ],
    )

    print(cl.retrieve('test', [1]))

    cl.upsert(
        "test",
        points=[
            models.PointStruct(
                id=1,
                vector=[
                    1.0, 0.3
                ],
                payload={},
            )
        ],
    )

    print(cl.retrieve('test', [1]))
    print()

Output:

grpc
[Record(id=1, payload={'a': 2}, vector=None, shard_key=None, order_value=None)]
[Record(id=1, payload={'a': 2}, vector=None, shard_key=None, order_value=None)]

http
[Record(id=1, payload={'a': 2}, vector=None, shard_key=None, order_value=None)]
[Record(id=1, payload={}, vector=None, shard_key=None, order_value=None)]

Metadata

Metadata

Assignees

Labels

bugSomething 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