milvus-io / milvus

A cloud-native vector database, storage for next generation AI applications
https://milvus.io
Apache License 2.0
29.51k stars 2.83k forks source link

[Enhancement]: Supports format checking for search parameters #15294

Closed xige-16 closed 2 years ago

xige-16 commented 2 years ago

Is there an existing issue for this?

What would you like to be added?

when search params is not correct, sdk or proxy should return error immediately.

Why is this needed?

when search with params:

     search_param = {
                    "data": [[random.random() for _ in range(dim)] for _ in range(5)],
                    "anns_field": "embeedings",
                    "param": {"metric_type": "L2"},
                    "limit": 2}

the error returned is confused:

Error: <BaseException: (code=1, message=no Available QueryNode result, filter reason [UnexpectedError] Assert "adapter->CheckSearch(conf, index_type, field_indexing->indexing_->index_mode())" at /home/xge/milvus/internal/core/src/query/SearchOnSealed.cpp:109
 => [SearchOnSealed]Search params check failed

Anything else?

No response

xige-16 commented 2 years ago

/assign @xige-16

xige-16 commented 2 years ago

link : https://github.com/milvus-io/milvus/issues/15139#issuecomment-1016042991

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Rotten issues close after 30d of inactivity. Reopen the issue with /reopen.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Rotten issues close after 30d of inactivity. Reopen the issue with /reopen.

xiaofan-luan commented 2 years ago

should fix this issue, very important to user experience

yaroslavm commented 2 years ago

For those sufferers who like me found this issue while googling an exception: I had the same error and the same behavior: no problems with a small collection and an exception with thousands (~5k-10k) of entities. It turns out that nprobe parameter becomes mandatory after some size (which actually quite small anyway). So don't forget to set nprobe any value in range 1 ~ 64 like UI does (more details about nprobe value are here: FAQ ). And here is a debug approach (for beginners like me):

  1. try vector search through UI (I mean attu here)
  2. if search works in attu but fails in your code - open network tab in dev console and compare the params sent to yours in code => improve your code.
  3. if search does not work in UI I suppose there is smth wrong with your collection/index.

Other issues with a similar problem: https://github.com/milvus-io/milvus/issues/15810 https://github.com/milvus-io/milvus/discussions/15908

xiaofan-luan commented 2 years ago

Anyone interested pls help on this issue

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Rotten issues close after 30d of inactivity. Reopen the issue with /reopen.