create()
function on client.collections()
.
The create()
function takes two parameters:
books
:
_
are reserved for internal use.int()
function is used to define an integer:
float()
function is used to define a float:
bool()
function is used to define a boolean:
text()
function is used to define a text:
bytes()
is used to define a bytes field in the schema.
f32_vector()
function is used to define a vector field with 32-bit floating point values.
dimension
parameter to the f32_vector()
function:
u8_vector()
function is used to define a vector field with u8
values.
dimension
parameter to the u8_vector()
function:
binary_vector()
function is used to define a binary vector packed into u8
values. You can pass vector dimension
as a parameter (required, greater than 0) which will be validated when upserting documents.
topk
expects is 128 (1024 / 8).dimension
parameter to the binary_vector()
function:
f32_sparse_vector()
function is used to define a sparse vector field with 32-bit floating point values.
u8_sparse_vector()
function is used to define a sparse vector field with 8-bit unsigned integer values.
list()
function is used to define a list field. List can define a list of strings, integers and floats.
text
, integer
, float
.required()
is used to mark a field as required. All fields are optional
by default.
index()
function is used to create an index on a field.
This function accepts a single parameter specifying the index type:
semantic_index()
semantic_index()
can only be called over text()
data type.
model
parameter and embedding_type
parameter to the semantic_index()
function:
cohere/embed-english-v3
cohere/embed-multilingual-v3
(default)float32
uint8
binary
vector_index()
f32_vector
, u8_vector
, binary_vector
, f32_sparse_vector
, or u8_sparse_vector
fields.
metric
when calling vector_index()
. This parameter determines how vector similarity is calculated:
euclidean
(not supported for sparse vectors)cosine
(not supported for sparse vectors)dot_product
(supported for dense and sparse vectors)hamming
(only supported for binary_vector()
type).required()
), in which case no data is stored for that document — null vectors are not substituted with dummy or zero vectors.keyword_index()