3.3.4. START

Find starting points through legacy indexes.

The START clause should only be used when accessing legacy indexes. In all other cases, use MATCH instead (see Section 3.3.1, “MATCH”).

In Cypher, every query describes a pattern, and in that pattern one can have multiple starting points. A starting point is a relationship or a node where a pattern is anchored. Using START you can only introduce starting points by legacy index seeks. Note that trying to use a legacy index that doesn’t exist will generate an error.

This is the graph the examples are using:

Figure 3.7. Graph
alt

3.3.4.1. Get node or relationship from index

Node by index seek

When the starting point can be found by using index seeks, it can be done like this: node:index-name(key = "value"). In this example, there exists a node index named nodes.

Query. 

START n = node:nodes(name = 'A')
RETURN n

The query returns the node indexed with the name “A”.

Result. 

+-------------------+
| n                 |
+-------------------+
| Node[0]{name:"A"} |
+-------------------+
1 row

Relationship by index seek

When the starting point can be found by using index seeks, it can be done like this: relationship:index-name(key = "value").

Query. 

START r = relationship:rels(name = 'Andrés')
RETURN r

The relationship indexed with the name property set to “Andrés” is returned by the query.

Result. 

+--------------------------+
| r                        |
+--------------------------+
| :KNOWS[0]{name:"Andrés"} |
+--------------------------+
1 row

Node by index query

When the starting point can be found by more complex Lucene queries, this is the syntax to use: node:index-name("query").This allows you to write more advanced index queries.

Query. 

START n = node:nodes("name:A")
RETURN n

The node indexed with name "A" is returned by the query.

Result. 

+-------------------+
| n                 |
+-------------------+
| Node[0]{name:"A"} |
+-------------------+
1 row