如何删除neo4j中的所有索引? [英] How to delete all indexes in neo4j?

查看:944
本文介绍了如何删除neo4j中的所有索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想批量删除使用cypher存在的所有索引吗?我正在使用neo4j 3.4.7.

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?

推荐答案

删除所有索引和约束的一种快速方法是使用APOC过程

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 *

该过程主要用于确保DB具有在前两个映射中传递的索引和约束,但是第三个参数确定是否删除了其他索引和约束.在上面的查询中,前2个映射为空,因此最终结果是所有索引和约束都被删除.

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.

这篇关于如何删除neo4j中的所有索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆