问题
I want to delete all indexes that exist using cypher in a bulk can it be done? I am using neo4j 3.4.7.
DROP INDEX ON :Label(attributename)
Does it replace existing indexes if I create the same index in a later stage?
回答1:
A quick way to drop all indexes and constraints is to use the APOC procedure apoc.schema.assert, as follows:
CALL apoc.schema.assert({},{},true) YIELD label, key
RETURN *
The procedure is mainly for ensuring that the DB has the indexes and constraints passed in the first 2 maps, but the third parameter determines whether any other indexes and constraints are dropped. In the above query, the first 2 maps are empty, so the end result is that all indexes and constraints are dropped.
回答2:
For release 3.x your can to use built-in procedures Neo4j to delate what index your want. From web browser your can send Cipher query:
CALL db.indexes()
- List all indexes in the database.
CALL db.index.fulltext.drop()
-Drop the specified index.
or
CALL db.index.explicit.drop()
- Remove an explicit index - YIELD type,name,config
All possible built-in procedures and parameter for last version here User management for Neo4j
old style do it with CIPHER :
DROP INDEX ON :labelOfNode(propertyOfNode)
CREATE INDEX ON :labelOfNode(propertyOfNode)
来源:https://stackoverflow.com/questions/52593664/how-to-delete-all-indexes-in-neo4j