If your data model has choosen to define multiple labels on a node, for example

create (n:Actor:Director {name:'Clint Eastwood'})

To find all nodes which are defined with both labels of Actor AND Director use the following Cypher:

match (n) where n:Actor and n:Director return n;

Using this syntax will be performant as it will start with a NodeByLabelScan

If you need to find all nodes which have either label of Actor OR Director use the following Cypher:

MATCH (n:Actor) RETURN n UNION MATCH (n:Director) RETURN n

Using this syntax will be performant as it will perform a NodeByLabelScan on both the Actor label and the Director label and then merge the results.

Details


Author:
Dana Canzano
Applicable versions:
2.3, 3.0
Keywords:
lablelsmultiple labels neoneo4j-2.3neo4j-3.0