Skip to content

Operators and functions

Function names are case-insensitive (toUpper, toupper and TOUPPER are the same). A function that is not listed here fails with function name is not supported (HTTP 400, code: "unsupported"). Unless noted otherwise, a NULL argument gives a NULL result.

Operators

OperatorMeaningExample → result
+Add numbers; concatenate strings or lists1 + 2 → 3, 'a' + 1 → 'a1', [1] + [2] → [1, 2]
-, *Subtract, multiply7 * 3 → 21
/Divide. Integer by integer truncates toward zero7 / 2 → 3, -7 / 2 → -3, 7.0 / 2 → 3.5
%Remainder (sign of the dividend)7 % -3 → 1
^Power, always a float2 ^ 10 → 1024.0
-xNegation-3
= <>Equality. 1 = 1.0 is true; lists and maps compare structurally[1,2] = [1,2] → true
< > <= >=Ordering for numbers, strings, dates, datetimes. Incompatible types give NULL'abc' < 'abd' → true, 1 < 'a' → null
AND OR XOR NOTThree-valued logicnull AND false → false, null OR true → true
IS NULL, IS NOT NULLNull testnull IS NULL → true
INList membership (NULL-aware)1 IN [1, null] → true, 2 IN [1, null] → null
STARTS WITH, ENDS WITH, CONTAINSString tests, case-sensitive'abc' CONTAINS 'b' → true
=~Regular expression, must match the whole string. (?i) for case-insensitive'Alice' =~ '(?i)al.*' → true
x[i]List index, negative from the end[1,2,3][-1] → 3
x[a..b], x[..b], x[a..]List slice (end exclusive)[1,2,3,4][1..3] → [2, 3]
m.key, n.propMap key or property access{a: 1}.a → 1

Integer arithmetic is 64-bit and wraps on overflow (9223372036854775807 + 1 → -9223372036854775808). Float division by zero gives Infinity, integer division by zero is an error.

Graph and identity

FunctionReturns
id(x)A node’s id as a UUID string; for a relationship, "<src>:<dst>".
elementId(x)A node’s id (UUID string); for a relationship, "<TYPE>-<src>-><dst>".
labels(n)List of the node’s labels, sorted.
type(r)The relationship type.
keys(x)Property keys of a node, relationship or map.
properties(x)Property map of a node or relationship.
nodes(p), relationships(p)The nodes / relationships of a path.
length(p)Number of relationships in a path.

n._id reads the node id as a property, and MATCH (n:Label {_id: $id}) looks a node up by it.

Lists

FunctionReturnsExample → result
size(x)Length of a list or string (characters), map size, or a vector’s dimensionsize('héllo') → 5
head(l), last(l)First / last element, null for an empty listhead([1,2]) → 1
tail(l)All but the first elementtail([1,2,3]) → [2, 3]
reverse(x)Reversed list or stringreverse([1,2,3]) → [3, 2, 1]
range(start, end[, step])Inclusive integer rangerange(0, 10, 3) → [0, 3, 6, 9], range(5, 1, -2) → [5, 3, 1]
coalesce(a, b, …)First non-null argumentcoalesce(null, 3) → 3

List expressions:

FormExample → result
[x IN list WHERE pred | expr][x IN range(1,5) WHERE x % 2 = 1 | x * 10] → [10, 30, 50]
any / all / none / single(x IN list WHERE pred)single(x IN [1,2] WHERE x = 2) → true
reduce(acc = init, x IN list | expr)reduce(s = 0, x IN [1,2,3] | s + x) → 6
[(a)-[:T]->(b) | b.name] (pattern comprehension)list of the matched names, per row

Strings

FunctionExample → result
toUpper(s), toLower(s)toUpper('straße') → 'STRASSE'
trim(s), ltrim(s), rtrim(s)trim(' a ') → 'a'
left(s, n), right(s, n)left('abc', 2) → 'ab'
substring(s, start[, length])substring('hello', 1, 3) → 'ell'
replace(s, search, replacement)replace('aXbX', 'X', '-') → 'a-b-'
split(s, delimiter)split('a,b', ',') → ['a', 'b']
reverse(s)reverse('ab') → 'ba'
size(s)Number of characters

Conversion

FunctionBehaviour
toString(x)Text form of a number, boolean, string, date or datetime (toString(date('2026-11-01')) → '2026-11-01').
toInteger(x)From a string or number; floats truncate toward zero (3.7 → 3). Unparseable input → null.
toFloat(x)From a string or number. Unparseable → null.
toBoolean(x)From 'true' / 'false' (case-insensitive), a boolean, or the integers 0 / 1. Anything else → null.

toStringOrNull, toIntegerOrNull and the other …OrNull variants are not implemented; the plain functions already return null for input they cannot parse.

Math

FunctionNotes
abs(x)Same type as the input.
sign(x)-1, 0 or 1 (integer).
round(x), floor(x), ceil(x)Return a float. round takes one argument (no precision argument); halves round away from zero.
sqrt(x)Float; sqrt(-1) is NaN.

Not implemented: exp, log, log10, e, pi, rand, sin and the other trigonometric functions.

Dates and times

FunctionReturns
date()Today (UTC) as a DATE.
date('YYYY-MM-DD')A DATE. Invalid dates are an error.
datetime()Now as a UTC DATETIME (microsecond precision).
datetime('ISO-8601')A UTC DATETIME. Offsets are converted ('2026-11-01T10:00:00+02:00' → 08:00 UTC); a bare date means midnight UTC.
localdatetime(…)Same as datetime(…), interpreted as UTC.
timestamp()Milliseconds since the Unix epoch, as an integer.

Dates and datetimes compare with <, = and friends and sort correctly. Map arguments (date({year: 2026, …})), component access (d.year returns null), duration, time and zoned types are not supported. Store instants as DATETIME or as epoch integers.

Vectors and text scoring

FunctionReturns
vector(list)A dense float vector. size(v) is its dimension.
cosine_similarity(a, b)Cosine similarity; higher is closer. NULL when either vector has zero magnitude.
dot_product(a, b)Dot product; higher is closer.
euclidean_distance(a, b)Euclidean (L2) distance; lower is closer.
bm25(text, query)A per-row BM25 score of text against query, without corpus-wide statistics.

The vector functions accept vectors or float lists and require equal dimensions (otherwise an error). A KNN written as ORDER BY cosine_similarity(n.embedding, $q) DESC LIMIT k uses a vector index when one exists; see Search.

Aggregates

FunctionNotes
count(*)Rows in the group.
count(x)Non-null values.
sum(x)0 for no values.
avg(x)Float; null for no values.
min(x), max(x)Numbers, strings, dates.
collect(x)List of non-null values.
stdev(x), stdevp(x)Sample / population standard deviation.
percentileCont(x, p), percentileDisc(x, p)p between 0.0 and 1.0; interpolated / nearest value.

Every aggregate takes DISTINCT: count(DISTINCT n.city), collect(DISTINCT n.age). Grouping keys are the non-aggregated items of the same RETURN or WITH.