Describe the problem
I’m using MilvusClientV2.listIndexes(ListIndexesReq) to check and auto-create indexes on specific vector fields before loading a collection into memory. According to the official documentation, listIndexes accepts both collectionName and fieldName, so I expected it to return only the indexes defined on that field. In practice, however, it ignores fieldName and returns all index names in the collection.
What I found in the code
listIndexes builds a DescribeIndexRequest with the provided fieldName, calls the gRPC stub’s describeIndex(...), but then simply maps every returned IndexDescription to its indexName without any client-side filtering.
- The SDK’s separate
describeIndex wrapper does filter by fieldName (or indexName) after the RPC, but listIndexes does not.
Expected behavior
- If
fieldName is supplied, listIndexes should return only the index names that correspond to that field.
- If the intention is to always return all indexes, then the
fieldName parameter should be removed from ListIndexesReq to avoid confusion.
Suggested fix
In GrpcMilvusClient.listIndexes, after receiving the DescribeIndexResponse, add a filter step such as:
response.getIndexDescriptionsList().stream()
.filter(desc -> request.getFieldName() == null
|| desc.getFieldName().equals(request.getFieldName()))
.map(IndexDescription::getIndexName)
.collect(Collectors.toList());
Describe the problem
I’m using
MilvusClientV2.listIndexes(ListIndexesReq)to check and auto-create indexes on specific vector fields before loading a collection into memory. According to the official documentation,listIndexesaccepts bothcollectionNameandfieldName, so I expected it to return only the indexes defined on that field. In practice, however, it ignoresfieldNameand returns all index names in the collection.What I found in the code
listIndexesbuilds aDescribeIndexRequestwith the providedfieldName, calls the gRPC stub’sdescribeIndex(...), but then simply maps every returnedIndexDescriptionto itsindexNamewithout any client-side filtering.describeIndexwrapper does filter byfieldName(orindexName) after the RPC, butlistIndexesdoes not.Expected behavior
fieldNameis supplied,listIndexesshould return only the index names that correspond to that field.fieldNameparameter should be removed fromListIndexesReqto avoid confusion.Suggested fix
In
GrpcMilvusClient.listIndexes, after receiving theDescribeIndexResponse, add a filter step such as: