ListIndexes()
Addedv2.6.x
This operation lists all indexes built on a specified collection.
func (c *Client) ListIndexes(ctx context.Context, opt ListIndexOption, callOptions ...grpc.CallOption) ([]string, error)
Request Syntax
option := milvusclient.NewListIndexOption(collectionName).
WithFieldName(fieldName)
result, err := client.ListIndexes(ctx, option)
PARAMETERS:
-
collectionName (string)
The name of the target collection.
OPTION METHODS:
-
WithFieldName(fieldName string)Sets the field name for the operation.
RETURN TYPE:
[]string, error
RETURNS:
A list of names. Returns an error if the operation fails.
EXCEPTIONS:
-
error
Check
err != nilfor failure details.
Example
import (
"context"
"fmt"
"github.com/milvus-io/milvus/client/v2/milvusclient"
)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
cli, err := milvusclient.New(ctx, &milvusclient.ClientConfig{
Address: milvusAddr,
})
if err != nil {
// handle err
}
indexes, err := cli.ListIndexes(ctx, milvusclient.NewListIndexOption("my_collection").WithFieldName("my_vector"))
if err != nil {
// handle err
}
fmt.Println(indexes)