Bulk Import Data in Neo4j 2

I fumbled with this for a while, so I thought I better document it.

UPDATE: The information in this post works fine if you have a small data set, but it's incredibly slow. So when your import file is large, the performance may be unacceptable. For example, when my text file was 5000 lines long, it took approximately 10 minutes to complete the import! I recently found that by using the Java API rather than Cipher queries, the performance is much, much better. And, if you need to ensure that your database remains available to end users during the import, you can create a server extension to do the job. It may sound really complicated, but it's not all that hard to do. I will try to get that documented and posted. For some reason this solution doesn't pop up much in search results.


Until then, here is the slow way to do it...


STEP 1 - Create the text file with your data. Here's a snippet of what mine looked like (note, for some weird reason, the properties of the first node were not being created unless I had a carriage return for the first line of the file!). The first two lines create 'People' nodes and the third line creates a relationship between them.

create (p:`Person` {`name`:"Bob"});
create (p:`Person` {`name`:"Jim"});
match p1:Person where p1.name="Bob", p2:Person where p2.name = "Jim" create p1-[:LIKES]->p2;



STEP 2 - Stop the Neo4j server (cd to the directory that has your neo installation and type this command):

./bin/neo4j stop



STEP 3 - Run the import (from the directory where neo is installed).

cat /path/to/textfile.txt | ./bin/neo4j-shell -path data/graph.db




Add a Comment...



It's an amazing article designed for all the internet viewers; they will take advantage from it I am sure. kjøpe fotballdrakter - 5/16/2017

DortheaAr Ryssland LarryStev DeanneDee Atletico Madrid RainaOgra NickiDowd Juventus ScotGoulb TessaNesm Polen MHKRenald CelsaWilk Chelsea TamiNorfl - 3/08/2017