Can I delete labels too after deleting everything?

For example, I delete:

MATCH (n) where n.channel = 'sports' DETACH DELETE n

Although it deletes all nodes and relationships of the 'n', the labels still shows up in the browser. It's annoying. How can I wipe out all traces of those nodes and relationships once they are deleted?

I think they do get deleted unless you have some index on them

1 Like

Hello @lingvisa :slight_smile:

Your current Cypher request deletes all nodes and their relationships which have a property channel equal to sports. If you want to delete nodes more safely, you can try:

CALL apoc.periodic.iterate("MATCH (n) WHERE n.channel = 'sports' RETURN n", "DETACH DELETE n", {batchSize:1000, iterateList:true})

Now, if you still can see Labels, make sure you don't have nodes remanining and if it's not the case, you must check if there are constraints or indexes:

CALL db.indexes

You can drop an index like this (doc):

DROP INDEX index_name

You can drop a constraint like this (doc):

DROP CONSTRAINT constraint_name

Regards,
Cobra