Skip to content

Clarify and implement fieldName filtering behavior in MilvusClientV2.listIndexes #1413

@jamm-king

Description

@jamm-king

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());

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