Off by default. Enable per collection with autoIndex: true, or leave it unset and set SOLIDB_AUTO_INDEX=1. An explicit autoIndex: false opts the collection out even when the env var is set.
When a FOR … FILTER var.field == … (or range, not null) would use an index and none exists, SoliDB creates a persistent, non-unique _auto_{field} index, backfills it, and uses it for that query. Nested fields keep dots (_auto_address.city). SORT is not auto-indexed: persistent indexes omit missing fields, so an auto-created sort index would drop documents.
Creating an index is a write, so the caller must hold Write or Admin — a
viewer token never persists one, on /cursor,
/sql, /explain, a transactional query or the binary
protocol alike. A query that carries no principal at all (an internal
materialised-view refresh, a queue job, a stream task) does not auto-index either.
- At most 16
_auto_* indexes per collection.
- Existing user (or edge) indexes on the same field are never duplicated, and neither is a composite index that already covers the FILTER.
_key, _id, _rev, sharded collections, and collections whose names start with _ are skipped.
- Collections above
SOLIDB_AUTO_INDEX_MAX_DOCS documents (default 1,000,000; 0 disables the ceiling) are skipped — the backfill runs inside the query that triggered it.
- If no document carries the field, the index is dropped again instead of sitting empty and consuming a slot.
EXPLAIN does not create indexes; it may set auto_index_candidate when this query would actually create one.