I want to add new relationship to the existing node in Neo4j with this syntax:
MATCH (a:User {name: "Jack", surname: "Roe"}),
(b:User {name: "Jack", surname: "Smith"})
CREATE (a) -[r:Knows]-> (b)
RETURN a,r,b
but I get this warning :
what does it mean and how should I modify my cypher query?
In your case you have nothing to do.
The warning, like it's explained in its description, is that you have a disconnected pattern : (a:User {name: "Jack", surname: "Roe"})
and (b:User {name: "Jack", surname: "Smith"})
are not linked.
So to create the result, Neo4j has to compute all the combinations of this 2 sets :
So it's a cartesian product between those 2 sets, and it's something that can take a lot of times, specially if one set has a high cardinality.
In your case, I assume you have one node Roe
and an other Jack
, so the cartesian product is just 1 x 1
, so it's easy.