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
nprobe
when performing similarity searches withIVF_FLAT
. - A way to override
nprobe
indoSimilaritySearch()
should be provided via either: - A configurable parameter in
SearchRequest
- A fallback to a reasonable default value (e.g.,
nprobe = 256
)
Current Behavior
- IVF_FLAT is used as the default index, but
nprobe
is not explicitly set indoSimilaritySearch()
. - This leads to low recall or 0 search results if
nprobe
defaults to a very small value (1
). - There is no exposed method to override
nprobe
inSearchRequest
.
Steps to Reproduce
- Initialize a
MilvusVectorStore
instance withinitializeSchema = true
. - Add some vector data to the store.
- Perform a similarity search using
doSimilaritySearch()
. - Observe that
nprobe
is not explicitly set, leading to poor recall or zero results.
Code Example:
```java 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
// Expecting search results, but sometimes returns 0 records due to missing nprobe
Comment From: dev-jonghoonpark
related document : https://milvus.io/docs/ivf-flat.md