Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Secondary Indexing

⚠️ Warning

HelixQL is deprecated in HelixDB v2. Queries are now written with the Rust DSL and dispatched as JSON — see the Querying guide. This section is kept as a reference for legacy HelixQL projects.

For the complete documentation index optimized for AI agents, see llms.txt.

You can create secondary indexes on node fields using the INDEX keyword. For enforcing uniqueness constraints, see Unique Indexes.

To create a secondary index, use the INDEX keyword:

N::NodeType {
  INDEX field1: String,
  field2: U32
}

This internally creates a table for the indexed field. To query a node by the indexed field, you can use object syntax:

QUERY getByIndex(index_field: String) =>
    node <- N<User>({field1: index_field})
    RETURN node

Note: You can currently only use indexing with nodes. Indexing for vectors is not supported yet.