neo4j如何完全删除标签(表)
1.删除标签数据
MATCH (n:Company) DETACH DELETE n;
2.查看标签上有那些索引
通过客户端连接到nego4j服务器(192.168.1.135)
[root@localhost bin]# cd /opt/neo4j/bin
[root@localhost bin]#./cypher-shell -a bolt://192.168.1.135:7687 -u neo4j -p neo4j123 --encryption false
neo4j@neo4j> show indexes;
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| id | name | state | populationPercent | type | entityType | labelsOrTypes | properties | indexProvider | owningConstraint | lastRead | readCount |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 8 | "constraint_292af0b4" | "ONLINE" | 100.0 | "RANGE" | "NODE" | ["Person"] | ["neo4jImportId"] | "range-1.0" | "constraint_292af0b4" | 2025-07-10T10:04:42.219Z | 64 |
| 12 | "constraint_2c1557e4" | "ONLINE" | 100.0 | "RANGE" | "NODE" | ["User"] | ["neo4jImportId"] | "range-1.0" | "constraint_2c1557e4" | 2025-07-10T10:05:36.410Z | 1700000 |
| 3 | "constraint_74fad970" | "ONLINE" | 100.0 | "RANGE" | "NODE" | ["User"] | ["id"] | "range-1.0" | "constraint_74fad970" | 2025-07-10T10:04:41.618Z | 1100017 |
| 5 | "constraint_8979eba8" | "ONLINE" | 100.0 | "RANGE" | "NODE" | ["Company"] | ["id"] | "range-1.0" | "constraint_8979eba8" | 2025-07-10T10:04:32.729Z | 160000 |
| 10 | "constraint_ebc680f1" | "ONLINE" | 100.0 | "RANGE" | "NODE" | ["Company"] | ["neo4jImportId"] | "range-1.0" | "constraint_ebc680f1" | 2025-07-10T10:05:37.029Z | 260000 |
| 7 | "idx_user_name" | "ONLINE" | 100.0 | "RANGE" | "NODE" | ["User"] | ["name"] | "range-1.0" | NULL | 2025-07-09T09:39:18.698Z | 34 |
| 1 | "index_343aff4e" | "ONLINE" | 100.0 | "LOOKUP" | "NODE" | NULL | NULL | "token-lookup-1.0" | NULL | 2025-07-11T01:09:35.183Z | 240 |
| 2 | "index_f7700477" | "ONLINE" | 100.0 | "LOOKUP" | "RELATIONSHIP" | NULL | NULL | "token-lookup-1.0" | NULL | 2025-07-09T06:56:55.888Z | 25 |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
8 rows
ready to start consuming query after 22 ms, results consumed after another 3 ms
3.删除标签上的索引和约束
drop constraint constraint_8979eba8;
drop constraint constraint_ebc680f1;
4.查看
neo4j@neo4j> CALL db.labels() YIELD label
RETURN label;
+----------+
| label |
+----------+
| "Person" |
| "User" |
+----------+
2 rows
ready to start consuming query after 38 ms, results consumed after another 0 ms
neo4j@neo4j>
浙公网安备 33010602011771号