Affected files: src/content/learn/data-models/vector-search/vector-indexes.mdx (parameter table + "Defaults to:" example), src/content/reference/query-language/statements/define/indexes.mdx
The documentation states in three places that the default vector element type for HNSW indexes is F64:
vector-indexes.mdx, parameter table: | TYPE | F64 | F64, F32, I64, I32, I16 | Vector type
vector-indexes.mdx, expanded-defaults example: DEFINE INDEX hnsw_idx ON pts FIELDS point HNSW DIMENSION 4 DIST EUCLIDEAN TYPE F64 EFC 150 M 12 M0 24 LM 0.402…;
define/indexes.mdx: "In SurrealDB the default type for vectors is F64."
Observed on SurrealDB v3.2.0 (official Docker image): defining an HNSW index without TYPE and exporting the database shows the index materialised with TYPE F32:
DEFINE INDEX hx ON pts FIELDS point HNSW DIMENSION 4 DIST EUCLIDEAN EFC 150 M 12;
surreal export then contains:
DEFINE INDEX hx ON pts FIELDS point HNSW DIMENSION 4 DIST EUCLIDEAN TYPE F32 EFC 150 M 12 M0 24 LM 0.40242960438184466f;
Could you confirm which side reflects the intent?
- If F32 is the intended default (it halves the resident memory of the in-RAM HNSW graph, which seems sensible), the three documentation spots should be updated to
F32.
- If F64 is intended, this looks like an engine defaulting bug and I would be happy to refile against
surrealdb/surrealdb.
Affected files:
src/content/learn/data-models/vector-search/vector-indexes.mdx(parameter table + "Defaults to:" example),src/content/reference/query-language/statements/define/indexes.mdxThe documentation states in three places that the default vector element type for HNSW indexes is
F64:vector-indexes.mdx, parameter table:| TYPE | F64 | F64, F32, I64, I32, I16 | Vector typevector-indexes.mdx, expanded-defaults example:DEFINE INDEX hnsw_idx ON pts FIELDS point HNSW DIMENSION 4 DIST EUCLIDEAN TYPE F64 EFC 150 M 12 M0 24 LM 0.402…;define/indexes.mdx: "In SurrealDB the default type for vectors isF64."Observed on SurrealDB v3.2.0 (official Docker image): defining an HNSW index without
TYPEand exporting the database shows the index materialised withTYPE F32:surreal exportthen contains:Could you confirm which side reflects the intent?
F32.surrealdb/surrealdb.