milvus icon indicating copy to clipboard operation
milvus copied to clipboard

[Bug]: [restful v2] When nq > 1, search interface always return the result of the first vector

Open yhmo opened this issue 1 year ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Environment

- Milvus version: v2.4.1
- Deployment mode(standalone or cluster):
- MQ type(rocksmq, pulsar or kafka):    
- SDK version(e.g. pymilvus v2.0.0rc2):
- OS(Ubuntu or CentOS): 
- CPU/Memory: 
- GPU: 
- Others:

Current Behavior

When nq > 1, search interface always return the result of the first vector

Expected Behavior

No response

Steps To Reproduce

1. Create a collection and insert some data:
 pymilvus import (
    MilvusClient,
    connections,
    FieldSchema, CollectionSchema, DataType,
    Collection,
    utility,
)

connections.connect(host='localhost', port='19530')
print(utility.get_server_version())


collection_name = "AAA"
dim = 3
metric_type = "L2"

fields=[
    FieldSchema(name="id", dtype=DataType.INT64, is_primary=True, auto_id=True),
    FieldSchema(name="vector", dtype = DataType.FLOAT_VECTOR, dim=dim),
]

schema = CollectionSchema(fields=fields)

if utility.has_collection(collection_name):
    utility.drop_collection(collection_name)

collection = Collection(name=collection_name, schema=schema)
print(f"Collection '{collection_name}' created")


collection = Collection(collection_name)

batch_count = 1000
data = [
    [[10 * (k + d) / batch_count for d in range(dim)] for k in range(batch_count)],  # vector
]
ret = collection.insert(data)
print("insert done")

collection.flush()
print("flush done")

collection = Collection(collection_name)
index_params = {
    'metric_type': metric_type,
    'index_type': "FLAT",
    'params': {},
}
collection.create_index(field_name="vector", index_params=index_params)
print("index done")

collection = Collection(collection_name)

collection.load()

2. Search with restful v2, nq=2

curl --location --request POST "http://localhost:19530/v2/vectordb/entities/search"
--header "Content-Type: application/json"
--data-raw '{ "collectionName": "AAA", "data": [ [0.3580376395471989, -0.6023495712049978, 0.18414012509913835], [0.3, -0.4, 0.5] ], "annsField": "vector", "limit": 3 }'


It only returns the result of the first vector:

{"code":200,"data":[{"distance":0.53010494,"id":449612794136101426},{"distance":0.5322084,"id":449612794136101427},{"distance":0.5349118,"id":449612794136101428}]}

Milvus Log

No response

Anything else?

No response

yhmo avatar May 08 '24 02:05 yhmo

/assign @PowderLi could you help on investigating this?

xiaofan-luan avatar May 08 '24 07:05 xiaofan-luan

/unassign

yanliang567 avatar May 14 '24 01:05 yanliang567

/assign @yanliang567

PowderLi avatar May 27 '24 02:05 PowderLi

/assign @zhuwenxing please help to verify and check if it need more test to cover this scenario.

/unassign

yanliang567 avatar May 27 '24 06:05 yanliang567