Skip to Content
We are live but in Staging 🎉

A number field is a scalar field that stores numeric values—either whole numbers (integers) or decimal numbers (floating-point). You use number fields for things you want to filter, range query, or join into business logic, like prices, quantities, counters, timestamps, and flags.

Supported number types

VBase supports the same numeric scalar field types as Milvus.

TypeWhat it storesCommon examples
BOOLBoolean values (true / false)is_active, is_verified
INT88-bit signed integersmall counters, tiny enums
INT1616-bit signed integermedium counters, small IDs
INT3232-bit signed integerquantities, counters
INT6464-bit signed integertimestamps, large counters/IDs
FLOAT32-bit floating-point numberscores, measurements
DOUBLE64-bit floating-point numberfinance/precision-critical values

When to use number fields

Number fields are often paired with vector search to make results context-aware.

  • E-commerce: filter by price, in_stock, rating
  • Observability: filter by latency_ms, status_code, error_rate
  • Security: filter by risk_score, is_blocked, event_ts

Example mental model:

“Find similar items AND match my business rules (price < 100, is_active = true).”

Add number fields to a schema

Below is an example schema that adds:

  • age as INT64 that allows null and defaults to 18
  • price as FLOAT that allows null (no default)

Tip: If you enable dynamic fields, you can insert scalar fields that weren’t declared ahead of time. This is flexible, but it’s usually best to keep critical fields explicitly declared.

# Python 3.10+ from dodil import Client from dodil.vbase import VBaseConfig, CollectionSchema, FieldSchema, DataType c = Client( service_account_id="...", service_account_secret="...", ) vbase = c.vbase.connect( VBaseConfig( host="vbase-db-<id>.infra.dodil.cloud", port=443, scheme="https", db_name="db_<id>", ) ) fields = [ # Primary key FieldSchema(name="pk", dtype=DataType.INT64, is_primary=True, auto_id=False), # Number fields FieldSchema(name="age", dtype=DataType.INT64, nullable=True, default_value=18), FieldSchema(name="price", dtype=DataType.FLOAT, nullable=True), # Vector field (example) FieldSchema(name="embedding", dtype=DataType.FLOAT_VECTOR, dim=1536), ] schema = CollectionSchema( fields=fields, description="Products with numeric fields", enable_dynamic_field=True, ) vbase.create_collection( collection_name="products", schema=schema, )
Last updated on