pymilvus icon indicating copy to clipboard operation
pymilvus copied to clipboard

[Bug]: [milvus_client][milvus] The error msg does not show the complete usage for query without all the required parameters

Open binbinlv opened this issue 1 year ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Describe the bug

The error msg does not show the complete usage for query without all the required parameters: when run

milvus_client.query(collection_name)

it shows "<MilvusException: (code=65535, message=empty expression should be used with limit)"

Expected Behavior

sth like "ids or filter or limit cannot be empty"

please specify the param "filter" or the param "limit"

Steps/Code To Reproduce behavior

import time
import numpy as np
from pymilvus import (
    MilvusClient,
)

dim = 8
collection_name = "hello_milvus"
milvus_client = MilvusClient()

has_collection = milvus_client.has_collection(collection_name, timeout=5)
if has_collection:
    milvus_client.drop_collection(collection_name)
milvus_client.create_collection(collection_name, dim, consistency_level="Strong", metric_type="L2")

print(fmt.format("    all collections    "))
print(milvus_client.list_collections())

print(fmt.format(f"schema of collection {collection_name}"))
print(milvus_client.describe_collection(collection_name))

rng = np.random.default_rng(seed=19530)
rows = [
        {"id": 1, "vector": rng.random((1, dim))[0], "a": 100},
        {"id": 2, "vector": rng.random((1, dim))[0], "b": 200},
        {"id": 3, "vector": rng.random((1, dim))[0], "c": 300},
        {"id": 4, "vector": rng.random((1, dim))[0], "d": 400},
        {"id": 5, "vector": rng.random((1, dim))[0], "e": 500},
        {"id": 6, "vector": rng.random((1, dim))[0], "f": 600},
]

print(fmt.format("Start inserting entities"))
insert_result = milvus_client.insert(collection_name, rows, progress_bar=True)
print(fmt.format("Inserting entities done"))
print(insert_result)
milvus_client.query(collection_name)


### Environment details

```markdown
- Hardware/Softward conditions (OS, CPU, GPU, Memory):
- Method of installation (Docker, or from source):
- Milvus version (v0.3.1, or v0.4.0): master-20240121-c8a78465
- pymilvus version: 2.4.0rc24
- Milvus configuration (Settings you made in `server_config.yaml`):

Anything else?

No response

binbinlv avatar Jan 22 '24 08:01 binbinlv

/assign @czs007

binbinlv avatar Jan 22 '24 08:01 binbinlv

In fact, we consider that not specifying any parameters implies a constant value of True. In this case, it is necessary to specify the limit.

czs007 avatar Feb 05 '24 12:02 czs007