-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Description
Milvus Vector - Unable to Set nprobe in doSimilaritySearch for Default IVF_FLAT When initializeSchema = true
Description
We are encountering an issue in MilvusVectorStore where it is not possible to set nprobe when performing similarity searches (doSimilaritySearch) if the index type is IVF_FLAT.
By default, IVF_FLAT is selected when initializeSchema = true, but nprobe is not explicitly set, leading to poor recall or zero results in some cases.
Expected Behavior
- Users should be able to set
nprobewhen performing similarity searches withIVF_FLAT. - A way to override
nprobeindoSimilaritySearch()should be provided via either:- A configurable parameter in
SearchRequest - A fallback to a reasonable default value (e.g.,
nprobe = 256)
- A configurable parameter in
Current Behavior
- IVF_FLAT is used as the default index, but
nprobeis not explicitly set indoSimilaritySearch(). - This leads to low recall or 0 search results if
nprobedefaults to a very small value (1). - There is no exposed method to override
nprobeinSearchRequest.
Steps to Reproduce
- Initialize a
MilvusVectorStoreinstance withinitializeSchema = true. - Add some vector data to the store.
- Perform a similarity search using
doSimilaritySearch(). - Observe that
nprobeis not explicitly set, leading to poor recall or zero results.
Code Example:
MilvusVectorStore vectorStore = MilvusVectorStore.builder(milvusClient, embeddingModel)
.initializeSchema(true) // Uses default IVF_FLAT
.build();
SearchRequest searchRequest = SearchRequest.query("example query")
.withTopK(5)
.withSimilarityThreshold(0.7); // No way to set nprobe
List<Document> results = vectorStore.similaritySearch(searchRequest);
// Expecting search results, but sometimes returns 0 records due to missing nprobeMetadata
Metadata
Assignees
Labels
No labels