CREATE INDEX index_2384723 IF NOT EXISTS FOR (n:Movie) ON (n.title)
call db.indexes() yield name, labelsOrTypes
where labelsOrTypes = ["Movie"]
DROP INDEX name IF EXISTS
RETURN name
Index with name index_2384723 to be dropped and a return value:
index_2384723
Invalid input 'R': expected 'e/E' (line 3, column 2 (offset: 77))
"DROP INDEX name IF EXISTS"
^
But why? Is this a neo4j cypher parsing bug or is the error on my side? I dont get it...
The standalone queries work
call db.indexes() yield name, labelsOrTypes
where labelsOrTypes = ["Movie"]
RETURN name
this works. and
DROP INDEX index_2384723 IF EXISTS
this works too...
It is not possible to get the index using cypher. The name returned by db.indexes() is the value string (or name) of the index rather than the index itself. You can delete it in below steps.
1. List the index (or indices) that you want to remove
call db.indexes() yield name, labelsOrTypes
WITH name, labelsOrTypes where ANY (lbl in ['Movie', 'Person'] WHERE lbl in labelsOrTypes)
RETURN name, labelsOrTypes
2. Pick the index (or indices) that you want to delete and copy/paste in neo4j browser
DROP INDEX index_2384723 IF EXISTS;
DROP INDEX index_Person IF EXISTS;
3. Execute and verify
Removed 1 index, completed after 4 ms.