问题描述
设置
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_2384723 的索引 和一个返回值:
index_2384723
现实
Invalid input 'R': expected 'e/E' (line 3,column 2 (offset: 77))
"DROP INDEX name IF EXISTS"
^
但是为什么呢?这是neo4j密码解析错误还是我这边的错误? 我不明白...
独立查询有效
call db.indexes() yield name,labelsOrTypes
where labelsOrTypes = ["Movie"]
RETURN name
这有效。 和
DROP INDEX index_2384723 IF EXISTS
这也有效...
解决方法
无法使用密码获取索引。 db.indexes() 返回的名称是索引的值字符串(或名称)而不是索引本身。您可以按照以下步骤将其删除。
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.