跳到主要内容

DescribeIndex()

This method returns the index details.

func (c *GrpcClient) DescribeIndex(ctx context.Context, collName string, fieldName string, opts ...IndexOption) ([]entity.Index, error)

Request Parameters

Parameter

Description

Type

ctx

Context for the current call to work.

context.Context

collName

Name of a collection

string

fieldName

Name of the field to index.

string

opts

Extra index settings

You can include multiple entity.IndexOption in this request.

client.IndexOption

Return

A list of entity.Index or an error.

Errors

Any error in the execution of the request. Possible errors are as follows:

  • ErrClientNotReady: The client is not connected to Milvus.

  • ErrCollectionNotExists: The specified collection does not exist.

  • A field with the same name does not exist.

  • The call to this API fails.

Example

// describe index
indexes, errDesc := mc.DescribeIndex(context.Background(), collectionName, "vector")
if errDesc != nil {
log.Fatal("failed to describe index:", errDesc.Error())
}
for _, idx := range indexes{
log.Println(idx.Name(), idx.IndexType(), idx.Params())
}