qdrant / qdrant-client

Python client for Qdrant vector search engine
https://qdrant.tech
Apache License 2.0
671 stars 106 forks source link

can not get "time" from api using the sdk #647

Open jiangying000 opened 2 weeks ago

jiangying000 commented 2 weeks ago

when delete by filter through api:

curl --location 'http://x:6333/collections/col/points/delete?wait=true' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data '{
    "filter": {
        "must": [
            {
                "key": "metadata.file_id",
                "match": {
                    "value": "abcd6dee-03ca-4d38-a45f-51d941fe2c01"
                }
            }
        ]
    }
}
'

result:

{
    "result": {
        "operation_id": 28272,
        "status": "completed"
    },
    "status": "ok",
    "time": 0.002382941
}

but through sdk, i can only get

class UpdateResult(BaseModel):
    operation_id: Optional[int] = Field(default=None, description="Sequential number of the operation")
    status: "UpdateStatus" = Field(..., description="")

https://github.com/qdrant/qdrant-client/blob/d18cb1702f4cf8155766c7b32d1e4a68af11cd6a/qdrant_client/async_qdrant_client.py#L1129

So the "status" and "time" field is omitted, can I get then when using sdk?

usage:

import qdrant_client

async_qdrant_client = qdrant_client.AsyncQdrantClient()

            res = await async_qdrant_client.delete(collection_name="col", points_selector=Filter(
                must=[FieldCondition(key='metadata.file_id', match=MatchValue(value=file_id_str))]
            ))

res is: operation_id=30016 status=<UpdateStatus.COMPLETED: 'completed'> no "status" and "time" field

joein commented 2 weeks ago

Hi @jiangying000

No, those fields are unavailable in public qdrant-client API

If you really need to, you can make requests from within qdrant-client on your own by utilising a bit low level API

if you create your client like

client = qdrant_client.QdrantClient()

then those API's can be reached as client._client.rest.<type of endpoint>.<method>

where <type of endpoint> is one of

[
    self.cluster_api,
    self.collections_api,
    self.points_api, 
    self.service_api,
    self.snapshots_api
]

But we do not recommend using those APIs directly

jiangying000 commented 2 weeks ago

No, those fields are unavailable in public qdrant-client API

it's an useful parametric, so please consider add them, like ElasticSearch always has this field, I can know the network cost and service internal processing time parts of a api latency.

jiangying000 commented 2 weeks ago

image

by the way, I see the api doc mention time and status field https://qdrant.github.io/qdrant/redoc/index.html#tag/points/operation/delete_points

joein commented 2 weeks ago

it's not the python client's doc, but the general openapi doc, you can get those values with pure http calls, but we don't expose them in the client