本文介绍了Neo4j - 是否有一个密码查询语法列出(显示)DB中的所有索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找类似于MySQL(SHOW INDEXES)的东西。我能够在Python中使用py2neo获取索引列表

I'm looking for something similar to the MySQL ( SHOW INDEXES ). I was able to get a list of indexes using py2neo in Python

graphDB = neo4j.GraphDatabaseService()
indexes = graphDB.get_indexes(neo4j.Node)
print(format(indexes))

但是我我想知道是否有办法在Cypher中做类似的事情。

but I wanted to know if there's a way to do something similar in Cypher.

推荐答案

尚未。在Neo4j 2.0中引入了更多的密码友好索引,您可以发出一些DDL命令来创建和删除索引和约束,但从2.01开始就是这样(参见)。在1.9中你无法用cypher定义那种类型的模式。

Not yet. In Neo4j 2.0 more cypher friendly indexing was introduced and you can issue some DDL commands to create and drop indices and constraints, but as of 2.01 that's it (see docs). In 1.9 you can't define that type of schema with cypher at all.

-

有cypher以外的很多方法,例如

There are many ways outside of cypher, for instance

neo4j-shell 中你可以


  • 列出遗留索引 index --indexes

  • 列出所有标签索引和架构的约束

  • 列出具有架构的特定标签的索引和约束ls -l:YourLabel

  • list legacy indices with index --indexes
  • list all label indices and constraints with schema
  • list indices and constraints for specific label with schema ls -l :YourLabel

neo4j-browser 中你可以


  • 列出所有标签索引和约束:schema

  • 使用列出特定标签的索引和约束:schema ls -l:YourLabel

  • list all label indices and constraints with :schema
  • list indices and constraints for specific label with :schema ls -l :YourLabel

大多数允许您执行cypher查询的API也会提供查询模式的方法,例如

Most APIs that let you execute cypher queries will also provide ways to query schema, such as


  • Native Java API

    • GraphDatabaseService.schema()。getConstraints() a标签架构的nd .getIndexes()

    • GraphDatabaseService.index()。nodeIndexNames() .relationshipIndexNames()

    • Native Java API
      • GraphDatabaseService.schema().getConstraints() and .getIndexes() for label schema
      • GraphDatabaseService.index().nodeIndexNames() and .relationshipIndexNames() for legacy indices

      • / db / data / schema / 基于标签的架构的端点

      • / db / data / index / node / / db / data / index / relationship / for legacy指数

      • /db/data/schema/ endpoints for label based schema
      • and to /db/data/index/node/ and /db/data/index/relationship/ for legacy indices

      这篇关于Neo4j - 是否有一个密码查询语法列出(显示)DB中的所有索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 09:41