メインコンテンツまでスキップ

AlterIndexProperties()

Addedv2.6.x

This operation modifies properties of an existing index.

func (c *Client) AlterIndexProperties(ctx context.Context, opt AlterIndexPropertiesOption, callOptions ...grpc.CallOption) error

Request Syntax

option := milvusclient.NewAlterIndexPropertiesOption(collectionName, indexName).
WithProperty(key, value)

err := client.AlterIndexProperties(ctx, option)

PARAMETERS:

  • collectionName (string)

    The name of the target collection.

  • indexName (string)

    The name of the index.

OPTION METHODS:

  • WithProperty(key string, value any)

    Sets a custom property key-value pair on the resource.

RETURN TYPE:

error

RETURNS:

Returns nil on success, or an error describing what went wrong.

EXCEPTIONS:

  • error

    Check err != nil for failure details.

Example

import (
"context"

"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
}
defer cli.Close(ctx)

err = cli.AlterIndexProperties(ctx, milvusclient.NewAlterIndexPropertiesOption("my_collection", "my_index").
WithProperty("mmap.enabled", true))
if err != nil {
// handle err
}