I have to found all paths between two nodes. The length of each path has to be beetween 1 and 5 ( 2 and 3 for this exemple ).
So i'm using this query :
profile match p = (a:Station {name : 'X'} ) - [r*2..3] -> (b:Station {name : 'Y'} ) return distinct p
I have an index on :Station(name)
but when I profile this query I have this result :
So the problem is neo4j takes every relationship possible for this node B and then filters using the name. Is it a way for just taking the relation which involved this two specific nodes ?
match a-[r]-b return type(r)
will return the list of relationship types you actually have. I think you have to use relationship types to avoid getting every relationships when you actually need only one. – Supamiu