Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Search reduce result is unexpected #2260

Open
1 task done
yhmo opened this issue Sep 11, 2024 · 1 comment
Open
1 task done

[Bug]: Search reduce result is unexpected #2260

yhmo opened this issue Sep 11, 2024 · 1 comment
Labels
kind/bug Something isn't working

Comments

@yhmo
Copy link
Contributor

yhmo commented Sep 11, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Create a collection.
Insert 3 entities with the same ID, but different vectors.
Search with the first vector, set output_fields=["id", "vector"]
Return one entity, the distance is 1, but the vector is not the first vector.

Use this script to test:

from pymilvus import (
    MilvusClient
)

client = MilvusClient(uri="http://localhost:19530")  # standalone

collection_name="demo_collection"
client.drop_collection(collection_name)
client.create_collection(collection_name=collection_name, dimension=4)

client.insert(collection_name=collection_name,data={"id": 5, "vector": [1,2,3,4]})
client.insert(collection_name=collection_name,data={"id": 5, "vector": [2,2,2,2]})
client.insert(collection_name=collection_name,data={"id": 5, "vector": [3,3,3,3]})

print(client.query(collection_name=collection_name, filter="", output_fields=["count(*)"], consistency_level="Strong"))

query_embeddings = [[1,2,3,4]]
result = client.search(
    collection_name=collection_name,
    data=query_embeddings,
    limit=6,
    output_fields=["id", "vector"],
)
print("Search results")
for hits in result:
    for hit in hits:
        print(f"hit: {hit}")

It returns:

data: ["{'count(*)': 3}"] 
Search results
hit: {'id': 5, 'distance': 0.9999999403953552, 'entity': {'vector': [3.0, 3.0, 3.0, 3.0], 'id': 5}}

The 'distance' is 0.9999999, but the 'vector' is [3.0, 3.0, 3.0, 3.0], I suppose it should return [1,2,3,4].

Expected Behavior

No response

Steps/Code To Reproduce behavior

No response

Environment details

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

Anything else?

No response

@yhmo yhmo added the kind/bug Something isn't working label Sep 11, 2024
@LacNguyen-Vidoori
Copy link

LacNguyen-Vidoori commented Oct 17, 2024

sorry - please pardon the ignorance... Just curious, since I'm trying to put together a somewhat similar test case:

  1. did you have Auto_id or some other attribute set as the primary key for this collection, that's why you were able to input same id value for 3 different entities?

  2. could you share the config settings that would let you create/load a Collection without an index specified?

  3. so it did return all 3 results (since (data: ["{'count(*)': 3}"])), it's just that you had expected [1,2,3,4] to rank 1st? Maybe because of the 'Strong' setting that always return the latest data? (your scripts had [3,3,3,3] inserted last)

sorry again if these questions seem dumb... i'm a noob at this and trying to learn as much as i can. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants