Skip to content

Bug in haystack/document_stores/milvus.py search_param #4681

@hyunsir

Description

@hyunsir

Describe the bug
A bug in haystack/blob/main/haystack/document_stores/milvus.py.
In MilvusDocumentStore, search_param, line 167:
self.search_param = search_param or {"nprobe": 10}
And in line 433:
param={"metric_type": self.metric_type, **self.search_param},
query with milvus2 will give an error due to this incorrect parameter passing

Error message
ERROR:pymilvus.decorators:RPC error: [search], <MilvusException: (code=1, message=fail to search on all shard leaders, err=All attempts results:
attempt #1:code: UnexpectedError, error: fail to Search, QueryNode ID=14, reason=Search 14 failed, reason [UnexpectedError] Error in virtual knowhere::DatasetPtr knowhere::IVF_NM::Query(const DatasetPtr&, const Config&, faiss::BitsetView) at IndexIVF_NM.cpp:216: [json.exception.out_of_range. 403] key 'nprobe' not found err %!w()
attempt #2:context canceled
)>, <Time:{'RPC start': '2023-04-17 10:19:17.569321', 'RPC error': '2023-04-17 10:19:17.987552'}>

Error Reason
According to https://milvus.io/docs/search.md , search_params = {"metric_type": "L2", "params": {"nprobe": 10}, "offset": 5}
But in line 433, it will be search_params = {"metric_type": "L2", "nprobe": 10}, if user uses default self.search_param

Method of correction
change line 433 into:
param={"metric_type": self.metric_type, "params": self.search_param},
or change line167 and related describe:
self.search_param = search_param or {"params":{"nprobe": 10}}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions