如何解决Neo4j 嵌入式 DROP INDEX 引发奇怪的错误
设置
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.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。