Skip to main content

alter_collection_field()

This operation changes the specified collection field parameters.

Request Syntax​

python
alter_collection_field(
collection_name: str,
field_name: str,
field_params: Dict,
db_name="",
timeout: Optional[float] = None,
**kwargs,
)

PARAMETERS:

  • collection_name (str) -

    The name of the target collection.

  • field_name (str) -

    The name of the target field.

  • field_params (dict) -

    The field parameters to change. The properties not mentioned remain unchanged. Possible parameters vary with the field type.

    • mmap_enabled (bool) -

      Whether Milvus maps the field data into memory instead of fully loading it. For details, refer to MMap-enabled Data Storage.

  • timeout (Optional[float]) -

    The timeout duration for this operation.

    Setting this to None indicates that this operation timeouts when any response arrives or any error occurs.

Notes

You must alter field settings before loading the collection. Altering a field on a loaded collection returns an error. To change settings on a loaded collection, release the collection first, alter the field, then reload.

RETURN TYPE:

NoneType

RETURNS:

None

EXCEPTIONS:

  • MilvusException

    This exception will be raised when any error occurs during this operation, especially when the specified alias does not exist.

Example​

python
from pymilvus import MilvusClient

# 1. Create a milvus client
client = MilvusClient(
uri="https://inxx-xxxxxxxxxxxx.api.gcp-us-west1.zillizcloud.com:19530",
token="user:password"
)

# upsert properties
field_params = {"max_length": 1500}

client.alter_collection_field(
collection_name="collection_name",
field_name="my_varchar",
field_params=field_params
)
Minimum SDK versionv2.4.x