The Neo4j Cypher Manual v5

Cypher is Neo4j’s graph query language that allows users to store and retrieve data from the graph database. It is a declarative, SQL-inspired language for describing visual patterns in graphs. The syntax provides a visual and logical way to match patterns of nodes and relationships in the graph.

Documentation updates for Neo4j 5

Neo4j 5 includes a number of new features and updates. A highlight of these include:

  • Cypher syntax improvements with Graph Pattern Matching (relationships and labels):

    • In MATCH clauses, WHERE can be placed inside a relationship pattern to filter relationships.

    • In MATCH clauses, nodes and relationships can be filtered using more sophisticated label (type) expressions.

    • Simpler alternative syntax to navigate and traverse graphs using the following operators:

      • &: logical AND

      • |: logical OR

      • !: logical NOT

      • %: a "wildcard", meaning "any label" (in Cypher this translates to size(labels(n)) > 0).

    For more information, see the section on Label expressions and in the WHERE clause.

  • New elementID for graph objects:

    New IDs are introduced to uniquely identify graph elements in Neo4j databases. Node ID will exist with each release of Neo4j 5.

    For more information, see elementId().

  • Composite databases.

    Composite databases allow queries that access multiple graphs at once. You can create, update, and remove configurations without a restart, whether the database is within the same cluster, or hosted remotely.

    For more information on composite databases, and how to create composite databases, see Operations Manual → Composite databases, and Creating composite databases.

  • Immutable privileges.

    Immutable privileges are useful for restricting the actions of users who themselves are able to administer privileges.
    For more information, see Immutable privileges.

  • Execute and ExecuteBoosted privilege.

    The permissions for the execution of admin procedures have been refreshed; these two privileges are now hierarchically related.

  • EXISTS and COUNT are now both expressions.

    For more information, see Subquery expressions.


    You can now combine these two commands in the same query. The ability to yield and filter the output from TERMINATE TRANSACTIONS has been added.

    For more information, see Updated features list.

  • Changes to Neo4j indexes:

    • The B-tree index type has been removed.

    • New Range and Point index types are available now.

    • Faster Text index provider for ENDS WITH and CONTAINS queries is introduced.

    • Full-text indexes can now index lists of strings.

    For more information, see new index types.

© 2023 Neo4j, Inc.

Documentation license: Creative Commons 4.0