Reputation: 43
I'm new to Neo4j, and I'm trying to use its import tool to import a bunch of legacy data into a new database. The main ID for this data will be integers. However, it seems that the :ID property of a node defaults to a string type? I know I can use :int on other properties to make them integer type, but it doesn't seem possible to combine that with :ID.
For example, here's node type 1:
node1_int_id:ID(node1)|other_prop|another_prop
12345 |foo |bar
node type 2:
node2_int_id:ID(node2)|other_prop|another_prop
67890 |foo |bar
and the relationships
:START_ID(node1) |:END_ID(node2)
12345 |67890
This seems to work, but the result is a relationship based on two string-type fields. So I guess I have two questions:
1)Am I doing this right? Is there some way to make the ID fields integers that I'm not seeing?
2)If I have to do it this way, is it a problem that they are strings? This will eventually result in a fairly large database of ~100 million nodes and relationships, so it seems like a bad idea to be looking for relationships based on a string comparison.
Upvotes: 4
Views: 995
Reputation: 67019
The Command line usage page of the neo4j import tool documents this command line option:
--id-type <id-type>
One out of [STRING, INTEGER, ACTUAL] and specifies how ids in node/relationship input files are treated.
STRING: arbitrary strings for identifying nodes. INTEGER: arbitrary integer values for identifying nodes. ACTUAL: (advanced) actual node ids.
The default option is STRING.
So, you should specify --id-type INTEGER
on the command line when running the import tool.
Upvotes: 2