create_field_schema()

This operation creates a field schema. It wraps FieldSchema.

Request syntax

MilvusClient.create_field_schema(
    name: str,
    data_type: DataType,
    desc: str = "",
    **kwargs
) -> FieldSchema

This is a class method. You should call this method like this: MilvusClient.create_field_schema().

PARAMETERS:

  • name (str) -

    [REQUIRED]

    The name of the field.

  • data_type (DataType) -

    [REQUIRED]

    The data type of the field.

  • desc (str) -

    The description of the field.

  • kwargs (dict) -

    Additional keyword arguments forwarded to the underlying FieldSchema, such as is_primary for the primary key, auto_id for automatic ID generation, dim for vector fields, and max_length for VARCHAR fields.

RETURN TYPE:

FieldSchema

RETURNS:

The created field schema.

EXCEPTIONS:

  • MilvusException

    This exception will be raised when any error occurs during this operation.

Example

from pymilvus import MilvusClient, DataType

field = MilvusClient.create_field_schema(
    name="id",
    data_type=DataType.INT64,
    is_primary=True,
)

Try Managed Milvus for Free

Zilliz Cloud is hassle-free, powered by Milvus and 10x faster.

Get Started
Feedback

Was this page helpful?