func (c *grpcClient) DescribeIndex(ctx context.Context, collName string, fieldName string) ([]entity.Index, error) {
	if c.service == nil {
		return []entity.Index{}, ErrClientNotReady
	}
	if err := c.checkCollField(ctx, collName, fieldName); err != nil {
		return []entity.Index{}, err
	}
	req := &server.DescribeIndexRequest{
		CollectionName: collName,
		FieldName:      fieldName,
		IndexName:      "",  
	}
	resp, err := c.service.DescribeIndex(ctx, req)
	if err != nil {
		return []entity.Index{}, err
	}
	if err := handleRespStatus(resp.GetStatus()); err != nil {
		return []entity.Index{}, err
	}
	indexes := make([]entity.Index, 0, len(resp.GetIndexDescriptions()))
	for _, info := range resp.GetIndexDescriptions() {
		params := entity.KvPairsMap(info.Params)
		it := params["index_type"]  
		idx := entity.NewGenericIndex(
			info.IndexName,
			entity.IndexType(it),
			params,
		)
		indexes = append(indexes, idx)
	}
	return indexes, nil
}
DescribeIndex describe index
package client
import (
	"context"
	"errors"
	"fmt"
	"time"
	"github.com/milvus-io/milvus-sdk-go/v2/entity"
	"github.com/milvus-io/milvus-sdk-go/v2/internal/proto/common"
	"github.com/milvus-io/milvus-sdk-go/v2/internal/proto/server"
)
func (c *grpcClient) checkCollField(ctx context.Context, collName string, fieldName string) error {
	if err := c.checkCollectionExists(ctx, collName); err != nil {
		return err
	}
	coll, err := c.DescribeCollection(ctx, collName)
	if err != nil {
		return err
	}
	var f *entity.Field
	for _, field := range coll.Schema.Fields {
		if field.Name == fieldName {
			f = field
			if f.DataType != entity.FieldTypeFloatVector && f.DataType != entity.FieldTypeBinaryVector {
				return fmt.Errorf("field %s of collection %s is not vector field", fieldName, collName)
			}
			break
		}
	}
	if f == nil {
		return fmt.Errorf("field %s of collection %s does not exist", fieldName, collName)
	}
	return nil
}
func (c *grpcClient) CreateIndex(ctx context.Context, collName string, fieldName string,
	idx entity.Index, async bool) error {
	if c.service == nil {
		return ErrClientNotReady
	}
	if err := c.checkCollField(ctx, collName, fieldName); err != nil {
		return err
	}
	req := &server.CreateIndexRequest{
		DbName:         "",  
		CollectionName: collName,
		FieldName:      fieldName,
		ExtraParams:    entity.MapKvPairs(idx.Params()),
	}
	resp, err := c.service.CreateIndex(ctx, req)
	if err != nil {
		return err
	}
	if err = handleRespStatus(resp); err != nil {
		return err
	}
	if !async {  
		for {
			is, err := c.GetIndexState(ctx, collName, fieldName)
			if err != nil {
				return err
			}
			switch is {
			case entity.IndexState(common.IndexState_Failed):
				return errors.New("index build failed")
			case entity.IndexState(common.IndexState_Finished):
				return nil
			default:
			}
			time.Sleep(100 * time.Millisecond)  
		}
	}
	return nil
}