I have nodes with labels a, b, c, d and I want to search a node "node1" only from label "a" and label "b". If "node1" is found then return that node else create a node with label "a".
I tried to do like this:
Merge(n {id: "node1"})
on create set n:a
return n
The only problem in this is that it will search from labels from "a", "b", "c", "d" and it's very time consuming.
In short it's a ALLNODESCAN and I want to search only from labels "a" and "b".