Neo4j get_or_create unique REST batch API issue -
the following rest api batch fails:
post http://localhost:7474/db/data/batch [{"method":"post","to":"index/node/name uniqueness=get_or_create","body":{"key":"name","value":"person1","properties":{"type":"person"}},"id":1}, {"method":"post","to":"index/node/name?uniqueness=get_or_create","body":{"key":"name","value":"person2","properties":{"type":"person"}},"id":2}, {"method":"post","to":"{1}/relationships","body":{"type":"knows","to":"{2}","data":{"since":"2012"}},"id":3}]
with 500 internal server error.
for reason not seem possible refer nodes in batch {1} , {2} when using uniqueness=get_or_create. or missing something?
you can use cypher in third operation index lookup access newly created node.
start n1=node:name(name={name1}), n2=node:name(name={name2}) create n1-[:knows {props}]->n2
with parameters
{ "query":"start n1=node:name(name={name1}), n2=node:name(name={name2}) create n1-[:knows {props}]->n2", "params":{"name1":"person1","name2":"person2","props":{"since":"2012"}} }
Comments
Post a Comment