drop_collection_field()
Addedv3.0.x
This operation removes a field from an existing collection schema by field name or field ID.
Request Syntax
drop_collection_field(
self,
collection_name: str,
field_name: str = "",
field_id: int = 0,
timeout: Optional[float] = None,
**kwargs,
)
PARAMETERS:
-
collection_name (str) -
The name of the target collection.
-
field_name (str) -
The field name to remove. Provide this when you identify the field by name.
-
field_id (int) -
The field ID to remove. Use this when your workflow tracks schema by field ID.
-
timeout (Optional[float]) -
The timeout for this operation in seconds.
-
kwargs (dict) -
Additional request options passed to the underlying RPC.
RETURN TYPE:
NoneType
This operation does not return data.
EXCEPTIONS:
-
MilvusException
Raised when the collection does not exist, the field cannot be resolved, or the request fails.
Example
from pymilvus import MilvusClient
client = MilvusClient(uri="YOUR_CLUSTER_ENDPOINT", token="YOUR_CLUSTER_TOKEN")
client.drop_collection_field(
collection_name="products",
field_name="legacy_score",
)