Skip to main content

Index Configuration Types

IndexIVFSQ

IVFSQ (Scalar Quantization) index configuration, compresses each dimension independently for a balance of speed and index size:
The sq_bits parameter controls the precision of the scalar quantization. Higher values provide higher recall at the cost of larger index sizes. Accepted values are 8 and 16, with 16 being the default.

IndexIVFFlat

IVFFlat index configuration, suitable for highest accuracy requirements:

IndexIVFPQ

IVFPQ (Product Quantization) index configuration, optimized for memory efficiency:
Both pq_dim and pq_bits are required parameters for IndexIVFPQ. Unlike IndexIVFSQ and IndexIVFFlat, these parameters must be explicitly specified.

Vector Item Format

Dictionary format for upsert operations:

Query Result Format

Results returned from query operations:

Metadata Filtering

The filters parameter in query operations supports MongoDB-style operators:

Supported Operators

  • $eq: Equality ({"category": "research"})
  • $ne: Not equal ({"status": {"$ne": "draft"}})
  • $gt: Greater than ({"score": {"$gt": 0.8}})
  • $gte: Greater than or equal ({"year": {"$gte": 2020}})
  • $lt: Less than ({"price": {"$lt": 100}})
  • $lte: Less than or equal ({"rating": {"$lte": 4.5}})
  • $in: In array ({"tag": {"$in": ["ai", "ml"]}})
  • $nin: Not in array ({"category": {"$nin": ["spam", "deleted"]}})
  • $and: Logical AND ({"$and": [{"a": 1}, {"b": 2}]})
  • $or: Logical OR ({"$or": [{"x": 1}, {"y": 2}]})

Filter Examples

Field Selection

Many operations support field selection through the include parameter:

Available Fields

  • vector: The vector data itself
  • contents: Text or binary content associated with the vector
  • metadata: Structured metadata object
  • distance: Similarity distance (query operations only)
The id field is always included in query results. Other fields such as distance and metadata are controlled by the include parameter (server default: [] — only id is returned unless include specifies additional fields).

Example Usage

Distance Metrics

Supported distance metrics for similarity calculations:
  • cosine: Cosine similarity (recommended for normalized vectors)
  • euclidean: Euclidean distance (L2 norm)
  • squared_euclidean: Squared Euclidean distance (faster than euclidean)