跳到主要内容
版本:v2.6.x

create_field_schema()

This operation creates a field schema. It wraps FieldSchema.

Request syntax​

Python
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.

Example​

Python
from pymilvus import MilvusClient, DataType

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