Documentation Index
Fetch the complete documentation index at: https://docs.helix-db.com/llms.txt
Use this file to discover all available pages before exploring further.
For the complete documentation index optimized for AI agents, see llms.txt.Every HelixQL feature on one page. Each entry shows what it does, its syntax variants, and links to the full documentation.
Query Structure
QUERY
Define a named query with typed parameters.
- A query with one typed parameter.
- A query with multiple typed parameters.
- A query with no parameters.
RETURN
Specify query output values.
- Return a single binding.
- Return multiple bindings.
- Return projected fields.
- Return only IDs.
- Return a string literal.
- Return no payload.
<- (Assignment)
Bind the result of an expression to a variable.
- Bind a node lookup to
user. - Bind a filtered traversal to
users. - Bind a count result to
count.
Comments (//)
Single-line comments.
- A standalone comment line.
- A comment at the end of a statement.
Types
Scalar Types
Built-in primitive types for schema fields and query parameters.- Text data.
- True/false value.
- 8-bit unsigned integer. Also available:
U16,U32,U64,U128. - 64-bit signed integer. Also available:
I8,I16,I32. - 64-bit floating point. Also available:
F32.
ID
UUID identifier type for nodes, edges, and vectors.
- Accept an ID as a query parameter.
- Access an element’s unique identifier in a property selection.
Date
Timestamp / RFC3339 date type.
- A date field in a schema.
- A date field with automatic timestamp default.
[T] (Arrays)
Array of any type.
- An array of 64-bit floats as a parameter.
- An array of objects as a parameter.
- An array of strings as a schema field.
Schema Definition
N:: (Node Schema)
Define node types with properties.
- Define a
Usernode type with three properties.
E:: (Edge Schema)
Define edge types with source, target, and optional properties.
- An edge with no properties connecting
UsertoUser. - An edge with properties connecting
UsertoUser.
V:: (Vector Schema)
Define vector embedding types with metadata properties.
- A vector type with metadata properties.
- A vector type with no extra properties.
INDEX
Create indexed fields for fast property-based lookup.
- Index the
emailfield onUsernodes for fast lookups viaN<User>({email: email}).
UNIQUE INDEX
Create unique constraints on fields, preventing duplicates.
- Enforce uniqueness on the
emailfield. - Enforce that only one
BestFriendedge can exist from a given user.
DEFAULT
Set default property values used when a value is not provided on insert.
- A schema with defaults for numbers, strings, timestamps, booleans, and NONE.
Node Operations
AddN
Create new nodes with optional properties.
- Create a
Usernode with no properties. - Create a
Usernode with a properties object.
N
Select nodes by type, by ID, or by indexed property.
- Select all
Usernodes. - Select a
Userby ID. - Select a
Userby an indexed property value.
UpsertN
Insert-or-update a node. Updates existing nodes from the traversal context, or creates a new one if none are found.
- Find existing nodes matching a condition.
- Upsert with the given properties — updates if found, creates if not.
Edge Operations
AddE
Create edges between nodes with optional properties.
- Create a
Followsedge between two nodes. - Create a
Friendsedge with properties.
E
Select edges by type or by ID.
- Select all
Followsedges. - Select a specific
Followsedge by ID.
UpsertE
Insert-or-update an edge. Operates on an existing edge traversal context — updates if an edge exists between the specified nodes, creates a new one otherwise.
- Select the edge type to operate on.
- Upsert with properties between two nodes — updates if found, creates if not.
Vector Operations
AddV
Create vector embeddings with optional properties.
- Create a vector with no metadata.
- Create a vector with metadata properties.
- Create a vector using the built-in
Embedfunction.
V
Select vectors by type or by ID.
- Select all
Documentvectors. - Select a specific vector by ID.
UpsertV
Insert-or-update a vector. Updates existing vectors from the traversal context, or creates a new one if none are found.
- Find existing vectors matching a condition.
- Upsert with new vector data and properties.
Embed
Generate vector embeddings from text using your configured embedding model.
- Embed text and store it as a vector.
- Embed a search query for vector similarity search.
Traversal Steps (from Nodes)
::Out
Follow outgoing edges and return the target nodes.
- Get all users that
user_idfollows. - Chain traversals to get followers-of-followers.
::In
Follow incoming edges and return the source nodes.
- Get all users that follow
user_id.
::OutE
Return the outgoing edges themselves (with their properties).
- Get the outgoing
Followsedge objects from a user.
::InE
Return the incoming edges themselves (with their properties).
- Get the incoming
Followsedge objects pointing at a user.
Traversal Steps (from Edges)
::FromN
Get the source node of an edge.
- Get the node that the
Createsedge originates from.
::ToN
Get the target node of an edge.
- Get the node that the
Createsedge points to.
::FromV
Get the source vector of an edge.
- Get the vector that the edge originates from.
::ToV
Get the target vector of an edge.
- Get the vector that the edge points to.
Filtering & Conditions
::WHERE
Filter elements by a condition.
- Filter users where
ageis greater than 18. - Filter users that have at least one follower.
- Combine multiple conditions with
AND.
::INTERSECT
Keep only elements that appear in a sub-traversal result for every upstream element.
INTERSECTtakes an anonymous traversal expression, such as_::In<HasTag>.- Helix runs that sub-traversal for each upstream element, then keeps only IDs shared across all sub-results.
- If the upstream set is empty (or there is no overlap), the final result is empty.
::EQ
Equals comparison. Works with strings, booleans, and numbers.
- Filter where
statusequals the string"active". - Filter where
nameequals a query parameter.
::NEQ
Not equals comparison. Works with strings, booleans, and numbers.
- Filter where
roleis not"admin".
::GT
Greater than comparison. Works with numbers.
- Filter where
ageis greater than 18.
::GTE
Greater than or equal comparison. Works with numbers.
- Filter where
ratingis at least 4.5.
::LT
Less than comparison. Works with numbers.
- Filter where
ageis less than 30.
::LTE
Less than or equal comparison. Works with numbers.
- Filter where
priorityis at most 2.
::CONTAINS
Check if a string contains a substring or an array contains an element.
- Filter where
namecontains the substring"john". - Filter where the outgoing
Followsset containsuser.
::IS_IN
Check if a value exists in an array.
- Filter where
statusis one of"active"or"pending".
EXISTS
Check if a traversal returns any results.
- Filter for elements that have incoming
Followsedges. - Filter for elements that have no incoming
Followsedges (negated with!).
Multiple Conditions (AND / OR / !)
Combine conditions with boolean logic.
- Match when all conditions are true.
- Match when any condition is true.
- Negate an
AND/ORblock by prefixing!.
Result Operations
::FIRST
Get the first element from a traversal result.
- Get the first
Usernode. - Get the first follower of a user.
::COUNT
Count the number of elements in a traversal result.
- Count all
Usernodes. - Count how many users follow
user_id.
::RANGE
Get a range of elements (inclusive start, exclusive end).
- Get the first 10 users (elements 0 through 9).
- Get a dynamic page of users using parameters.
::ORDER
Sort elements ascending or descending by a property.
- Sort users by
agedescending (oldest first). - Sort users by
ageascending (youngest first).
Aggregation
::GROUP_BY
Group elements by one or more properties, returning count summaries.
- Group users by
age, returning[{age: 25, count: 3}, ...]. - Group users by multiple properties.
::AGGREGATE_BY
Group elements by properties, returning counts and full data objects.
- Aggregate users by
department, returning counts and full user objects per group. - Aggregate by multiple properties.
Property Operations
::{} (Property Selection)
Select specific properties from elements.
- Return only
nameandagefrom each user. - Return three specific fields.
::ID
Access an element’s unique identifier.
- Return only the IDs of users.
- Map the ID to a custom field name alongside other properties.
::!{} (Property Exclusion)
Exclude specific properties, returning all others.
- Return all user properties except
emailandlocation.
Property Remapping
Rename properties in output using alias syntax.- Rename
nametodisplayNameandagetouserAge. - Map the ID to
userIDandnametodisplayName.
Spread Operator (..)
Include all properties while optionally adding or remapping specific fields.
- Include all schema properties plus a computed
userIDfield.
Nested Mappings (::|name|{})
Closure-style scoped property access for complex output structures.
- Scope
usras a reference touser, then use it inside nested property selections.
Computed Properties
Add derived values to output using traversals or expressions.- Add a
followerCountcomputed from the incomingFollowsedge count.
Modification Operations
::UPDATE
Update properties on existing elements.
- Update the
nameandageof a person. Omitted properties stay unchanged.
DROP
Delete elements and their related edges.
- Delete a user node and all its connected edges.
- Delete all nodes that the user follows (and connecting edges).
- Delete only the outgoing
Followsedges without touching neighbor nodes.
Search
SearchV
Vector similarity search using cosine similarity.
- Search for the 10 most similar
Documentvectors to a raw vector. - Search using an embedded text query with a dynamic limit.
SearchBM25
Keyword search using the BM25 ranking algorithm.
- Search
Documentnodes for keywords, returning up to 10 results. - Search with dynamic query text and limit.
Reranking
::RerankRRF
Reciprocal Rank Fusion — combine multiple ranked lists without score calibration.
- Apply RRF with the default
k=60. - Apply RRF with a custom
kparameter.
::RerankMMR
Maximal Marginal Relevance — diversify results by balancing relevance with diversity.
- Apply MMR with cosine distance (default).
- Apply MMR with euclidean distance.
- Apply MMR with dot product distance.
Shortest Path Algorithms
::ShortestPath
Default shortest path (BFS). Minimizes hop count when no weights are provided.
- Find the shortest unweighted path via
Roadedges.
::ShortestPathBFS
Unweighted shortest path using breadth-first search. Minimizes the number of hops.
- Find the shortest unweighted path from one city to another via
Roadedges.
::ShortestPathDijkstras
Weighted shortest path using Dijkstra’s algorithm.
- Find the shortest weighted path using the
distanceedge property as the weight.
::ShortestPathAStar
Heuristic shortest path using the A* algorithm.
- Find the shortest path using edge
distanceas weight and a nodeheuristicproperty for guidance.
Custom Weight Expressions
Define edge weights for path algorithms using property contexts.- Use an edge property as weight.
- Reference the source node’s property.
- Reference the target node’s property.
- Combine edge and node properties with arithmetic.
Control Flow
FOR ... IN
Iterate over collections and perform operations on each element.
- Loop through a collection of names and create a node for each element.
FOR with Destructuring
Unpack properties directly in the loop variable declaration.
- Destructure
name,age, andemailfrom each element and use them directly.
Math Functions
Arithmetic
Basic arithmetic operations.- Addition:
price + tax. - Subtraction:
total - discount. - Multiplication:
quantity * unit_price. - Division:
total / count. - Power:
base ^ exponent. - Modulo:
value % divisor.
Unary Math
Single-argument mathematical functions.- Absolute value.
- Square root.
- Natural logarithm.
- Base-10 logarithm.
- Logarithm with custom base.
- Exponential (
e^value). - Round up to nearest integer.
- Round down to nearest integer.
- Round to nearest integer.
Trigonometry
Trigonometric and inverse trigonometric functions (angles in radians).- Sine of an angle.
- Cosine of an angle.
- Tangent of an angle.
- Inverse sine (arc sine).
- Inverse cosine (arc cosine).
- Inverse tangent (arc tangent).
- Two-argument inverse tangent.
Constants
Mathematical constants.- Returns the value of pi (~3.14159).
- Returns the value of Euler’s number (~2.71828).
Aggregate Functions
Aggregate operations on collections.- Minimum value in a collection.
- Maximum value in a collection.
- Sum of all values.
- Average of all values.
- Number of elements.
Macros
#[model]
Specify which embedding model to use for Embed() calls within a query.
- Override the default embedding model for this query using the
#[model]macro.
#[mcp]
Expose a query as an MCP (Model Context Protocol) endpoint for AI agents.
- Mark a query as an MCP tool, making it accessible to LLM applications.
Output
Output Values
Return literals, computed values, and structured objects from queries.- Return a string literal.
- Return projected properties.
- Return multiple bindings.
- Return all properties except
email. - Return no payload.