Problems importing relationships

Hello i have Neo 1.1.12 on Mac OSX
with Neo Browser 3.4.9
i have a problem when i import a CSV for relationships within 2 nodes types: USER(user_id, user_name) and PAGE(page_id,page_name)

the command is:
USING PERIODIC COMMIT 500
load csv with headers from "http://127.0.0.1/NEO/neo-likes.csv" as line
MATCH (a:USER{user_id: line.user})
MATCH (b:PAGE{page_id: line.page})
CREATE (a)-[:LIKES]->(b)

but unfortunately only a part of relationships from the CSV are executed (around 27k on 220k total)
i don't understand where's the problem... is there any log of errors?
cheers

Your syntax looks ok. This is most likely caused by failing to MATCH a user or a page by that data from the CSV.

Is it possible that the CSV is mentioning users and pages that aren't already in your database?

If you switch from MATCH to MERGE, it will always succeed and create the relationships that you expect, but may end up creating the new USER and PAGE nodes that are missing. If that's OK, that's a way to go. Otherwise look deeper at individual lines that are failing to match, and see what you find from there.

excuse me
how would it be the syntax with merge?

Just change each match to merge. That's all.

USING PERIODIC COMMIT 500
load csv with headers from "http://127.0.0.1/NEO/neo-likes.csv" as line
MERGE (a:USER{user_id: line.user})
MERGE (b:PAGE{page_id: line.page})
CREATE (a)-[:LIKES]->(b)

ok thank you. i will try it, it's gonna take more than 1 hour

Make sure to create indexes on those ID fields like this, it will drastically speed up the merges.

CREATE INDEX ON :USER(user_id);
CREATE INDEX ON :PAGE(page_id);

ok thanks.
but something keeps not working
just imported me 35k relationships on 240k

iby the way
it seems i can add only 1 index... after i add the first the second statement return me a (no changes, no records)

probably the problem was the ";" now i created the double index and re-imported the relationships very quickly but... only 26K of them...
don't understand whats wrong

Most likely is that you have missing matches for your nodes.

for these:

MERGE (a:USER{user_id: line.user})
MERGE (b:PAGE{page_id: line.page})

You can check with:

load csv with headers from "http://127.0.0.1/NEO/neo-likes.csv" as line
OPTIONAL MATCH (a:USER{user_id: line.user})
OPTIONAL MATCH (b:PAGE{page_id: line.page})
WITH * WHERE a is null or b is null
RETURN line LIMIT 100