31

I've deleted all my nodes and relationships (Delete all nodes and relationships in neo4j 1.8), but I see that in Neo4j Browser the "property keys" that existed before the deletion remain.

See the picture below:

enter image description here

How can I make all the "Property Keys" go away too, so I can end up with a fresh new database? I understand this orphan property keys do not pose a problem themselves, but they clutter the browser experience and will start confusing with newer properties.

Thanks!

Community
  • 1
  • 1
jotadepicas
  • 2,389
  • 2
  • 26
  • 48
  • 1
    If you don't have any data you want to keep, you can just delete the whole database and create a new one. Unfortunately that doesn't help when you have data you want to keep, *short of* exporting it and re-importing it into a new database. – ADTC May 15 '16 at 12:49

6 Answers6

19

You should be able to clear everything out by:

  • stopping your Neo4j database
  • deleting everything matching data/graph.db/* (look inside the graph.db folder)
  • starting up again.
Monica Heddneck
  • 2,973
  • 10
  • 55
  • 89
Brian Underwood
  • 10,746
  • 1
  • 22
  • 34
  • 6
    OK, that did the trick, thanks! But what I wanted to know is how to remove unused properties. Suppose I didn't want to complete erase my database, just the property keys of deleted nodes that I won't be needing anymore. Is there a way of doing that? – jotadepicas Nov 29 '15 at 12:42
  • I'm not sure, unfortunately. Hopefully somebody will step in here, otherwise I would visit the Neo4j public Slack channel: http://neo4j.com/blog/public-neo4j-users-slack-group/ – Brian Underwood Nov 29 '15 at 15:19
  • Didn't like having to delete the directory content but it worked. There should be a better way to do this. – alfredocambera Jan 06 '16 at 19:21
  • I don't disagree ;) I believe that a "TRUNCATE" style command is on the todo list for the Neo folks – Brian Underwood Jan 07 '16 at 02:28
  • I can't find the `data/graph.db` folder anywhere on my OSX installation of Neo4j... – tumultous_rooster Apr 14 '16 at 20:56
  • Matt: Which version of Neo4j are you using? In 3.0 (just recently released as a release candidate), they changed the folder structure around some – Brian Underwood Apr 15 '16 at 06:00
  • 2
    for property keys delete neostore.propertystore.db.* files only – Stefanos Zilellis Nov 11 '18 at 08:49
1

What version of Neo4j are you using? Prior to to version 2.3 there is a file named keystore in the data/ directory that was used to populate this in the browser. Deleting this file will clear out the Labels, Relationship Types, and Property Keys listed in the browser.

Looks like this has changed now with Neo4j 2.3 so if you are using the latest version I don't think you'll have this file.

William Lyon
  • 8,371
  • 1
  • 17
  • 22
1

In the manual you can see that there is currently no way to disentangle which property keys are currently used without traversing the graph.

http://neo4j.com/docs/stable/rest-api-property-values.html#_property_keys

Which is a bummer because I'd like to do the same thing. TBC.

Darren McAffee
  • 645
  • 1
  • 6
  • 10
  • 1
    Looks like there's no way in v3.0.1. Tried deleting various combinations of `neostore.propertystore.*` but it just screws up the database in different ways. Seems like you just have to live with it until Neo fixes the problem. – ADTC May 15 '16 at 11:00
1

I have Neo4j Community Edition 3.2. To get rid of the property keys (and get rid of the entire DB), I completely uninstalled Neo4j, deleted the Neo4j folder in C:\Program Files and then reinstalled the package again so that I had a fresh DB to work with. Not ideal to delete everything but it worked for me.

Goofball
  • 735
  • 2
  • 9
  • 27
1

I got rid of the properties by open a new DB.|(I didn't want to delete my old folder ) Create a new folder beside the default folder stop the server choose the new folder and start again a new DB with new PW

Tal
  • 61
  • 1
  • 2
  • 7
-1

Actually, there is not a way to just delete the unused properties. You need to recreate the graph or use a tool to copy neo4j stores called "store-utils".