Data types

Updated at:
Copy as MD

This document describes the vector and scalar data types supported by Alibaba Cloud Vector Search with Milvus (Milvus). It covers their storage formats, applicable fields, and common scenarios to help you choose the most suitable data types for your application.

Data type

Applicable field

Storage format

Scenarios

BINARY_VECTOR

Vector field

Each dimension uses 1 bit to represent 0 or 1. This format has no exponent, mantissa, or sign bit and stores binary data directly.

Suitable for sparse vectors. In scenarios such as image processing and information retrieval, they are used as compact features for representing data.

FLOAT_VECTOR

A 32 bit single-precision floating-point number.

Suitable for general-purpose, high-precision vector search.

FLOAT16_VECTOR

A half-precision floating-point vector that uses a format with a 5 bit exponent, a 10 bit mantissa, and a 1 bit sign.

Suitable for scenarios that require high mantissa precision (more digits after the decimal point), such as embeddings generated by the bge-large model.

BFLOAT16_VECTOR

A 16 bit floating-point vector that uses a format with an 8 bit exponent, a 7 bit mantissa, and a 1 bit sign.

Suitable for scenarios where vectors have a large numerical range (more bits to represent integers).

SPARSE_FLOAT_VECTOR

Variable length of less than 32 bits. This format does not store all dimensions. It only stores the indices and corresponding float values of non-zero elements.

Suitable for text TF-IDF and ultra-high-dimensional one-hot encoding.

INT8_VECTOR

A vector of 8 bit signed integers (int8). The range of each component is from -128 to 127.

Suitable for quantized indexes to improve inference speed with minimal loss of precision. Note that this vector type only supports the HNSW index.

STRING

  • Primary key ID

  • Scalar fields

String.

Suitable for discrete, non-numeric classification information, such as text labels, category names, unique identifiers, short descriptions, status codes, and keywords.

INT64

64 bit integer.

Suitable for scalar properties that require a large range of integer values.

INT32

Scalar fields

32 bit integer.

Suitable for storing general integer data, such as product quantities or user IDs.

INT16

16 bit integer.

Suitable for medium-range integer data.

INT8

8 bit integer.

Suitable for storing small-range integer data.

BOOL

Boolean type.

Suitable for storing Boolean values (true or false) to describe binary states.

DOUBLE

64 bit double-precision floating-point number.

Used for high-precision data, such as financial information or scientific computing.

FLOAT

32 bit floating-point number.

Suitable for data that requires general precision, such as ratings or temperatures.

ARRAY

An array that stores a set of data elements of the same type. It accepts any scalar data type supported by Milvus except for JSON.

Suitable for a scalar field that contains multiple elements of the same type.

JSON

JSON format, for example, {"contact": {"phone": "+1800000****"}}

Suitable for storing collections of properties that have flexible structures, complex nesting, or dynamic changes.