14.13. Using

14.13.1. Query using an index hint
14.13.2. Query using multiple index hints

If you do not specify an explicit START clause, Cypher needs to infer where in the graph to start your query. One way Cypher might find start points is by looking at available indexes, but currently this can only be done automatically when there is only one index that is applicable to the query. If there is more than one possible index to use, you must use an index hint to tell cypher which index to use.

[Note]Note

You cannot use index hints if your query has a START clause.

14.13.1. Query using an index hint

To query using an index hint, use USING +INDEX.

Query. 

MATCH n:Swedish-->()
USING INDEX n:Swedish(surname)
WHERE n.surname = 'Taylor'
RETURN n

The query result is returned as usual.

Result

n
1 row
4 ms

Node[4]{name:"Andres",age:36,awesome:true,surname:"Taylor"}


14.13.2. Query using multiple index hints

To query using multiple index hints, use USING +INDEX.

Query. 

MATCH m:German-->n:Swedish
USING INDEX m:German(surname)
USING INDEX n:Swedish(surname)
WHERE m.surname = 'Plantikow' and n.surname = 'Taylor'
RETURN m

The query result is returned as usual.

Result

m
1 row
3 ms

Node[2]{name:"Stefan",surname:"Plantikow"}