Skip to main content

Classes

FieldIndex

Internal Instances of the FieldIndex class represents a field index created by vector_index, keyword_index, semantic_index, or multi_vector_index functions.

FieldSpec

Internal Instances of the FieldSpec class represents a field specification created by text, int, float, bool, f32_vector, u8_vector, i8_vector, binary_vector, f32_sparse_vector, u8_sparse_vector, bytes, list, struct, or matrix functions. Methods

required()

Mark a field as required. All fields are optional by default. Example:
Returns FieldSpec

optional()

Returns FieldSpec

index()

Create an index on a field. Example:
Parameters Returns FieldSpec

Functions

text()

Create a FieldSpec type for text values. Example:
Returns FieldSpec

int()

Create an integer field specification. Returns FieldSpec

float()

Create a FieldSpec type for float values. Example:
Returns FieldSpec

bool()

Create a FieldSpec type for bool values. Example:
Returns FieldSpec

f8_vector()

Create a FieldSpec type for f8_vector values. Example:
Parameters Returns FieldSpec

f16_vector()

Create a FieldSpec type for f16_vector values. Example:
Parameters Returns FieldSpec

f32_vector()

Create a FieldSpec type for f32_vector values. Example:
Parameters Returns FieldSpec

u8_vector()

Create a FieldSpec type for u8_vector values. Example:
Parameters Returns FieldSpec

i8_vector()

Create a FieldSpec type for i8_vector values. Example:
Parameters Returns FieldSpec

binary_vector()

Create a FieldSpec type for binary_vector values. Example:
Parameters Returns FieldSpec

f32_sparse_vector()

Create a FieldSpec type for f32_sparse_vector values. Note: Sparse vectors use u32 dimension indices to support dictionaries of up to 2^32 - 1 terms. Example:
Returns FieldSpec

u8_sparse_vector()

Create a FieldSpec type for u8_sparse_vector values. Note: Sparse vectors use u32 dimension indices to support dictionaries of up to 2^32 - 1 terms. Example:
Returns FieldSpec

bytes()

Create a FieldSpec type for bytes values. Example:
Returns FieldSpec

timestamp()

Create a FieldSpec type for timestamp values. Timestamps are stored as milliseconds since UNIX epoch. When upserting timestamps, use:
  • datetime.datetime — timezone-aware datetime (timezone-naive datetimes are not supported)
  • datetime.date — date (padded to midnight UTC)
  • int — epoch milliseconds
Example:
Returns FieldSpec

list()

Create a FieldSpec type for list values. Example:
Parameters Returns FieldSpec

struct()

Create a FieldSpec type for struct values. Example:
Parameters Returns FieldSpec

matrix()

Create a FieldSpec type for matrix values. Supported value_types:
  • f32
  • f16
  • f8
  • u8
  • i8
Example:
Parameters Returns FieldSpec

vector_index()

Create a FieldIndex type for vector_index values. Supported metrics:
  • euclidean (only dense vectors)
  • cosine (only dense vectors)
  • dot_product (dense and sparse vectors)
  • hamming (only binary vectors)
Example:
Parameters Returns FieldIndex

keyword_index()

Create a FieldIndex type for keyword_index values. Supported index types:
  • text (default) - text is tokenized before indexing
  • exact - text is indexed as a single term
Example:
Parameters Returns FieldIndex

semantic_index()

Create a FieldIndex type for semantic_index values. Example:
Returns FieldIndex

multi_vector_index()

Create a FieldIndex type for multi_vector_index values. Supported metrics:
  • maxsim
Example:
Parameters Returns FieldIndex

Type Aliases

SchemaFieldSpec

Type FieldSpec | Mapping[str, ‘SchemaFieldSpec’]