neo4j

Get nodes using multiple ids Cypher query neo4j

To get multiple nodes using multiple ids, you can use the below code. It will filter the nodes based on the ids provided in the WHERE clause.

MATCH (n)
WHERE ID(n) IN [0, 1, 7, 8, 10]
RETURN n

In the above Cypher query, we are getting nodes that have 0, 1, 7, 8, and 10 unique ids. The query will search all nodes that exist in the neo4j graph database and returns the matching nodes from them based on the ids.

Was this helpful?