Nicholas
Nicholas

Reputation: 7521

How to find a list of index using Cypher

I've created an INDEX using cypher for my :Person label, but I cannot find any way of printing out a list of indexes or constraints available to my Neo4j system.

Is this something that is doable via Cypher?

Upvotes: 5

Views: 8242

Answers (4)

szenyo
szenyo

Reputation: 522

In browser you can use :schema or schema in the shell to print out all the indexes and constraints.

Upvotes: 3

Kevin Cohen
Kevin Cohen

Reputation: 1341

As Eve pointed out, you can get labels by calling CALL.Labels(). To get indexes just do:

CALL db.indexes()

Also if you do CALL db. in your neo4j browser you will see all the functions available.

Upvotes: 11

Eve Freeman
Eve Freeman

Reputation: 33175

Nope. There's not even a way to list labels:

https://github.com/neo4j/neo4j/issues/1287

There are some REST calls for this, and the undocumented schema command in neo4j-shell is handy.

Edit: Update for 3.0 with the new stored procedures!

CALL db.labels()

Upvotes: 2

vstrom coder
vstrom coder

Reputation: 295

(Applicable to neo4j version 2.3.1 or later)

To get indexes via REST use this:

curl http://localhost:7474/db/data/schema/index/

In the neo4j console you can run the :schema command to get all indexes & constraints.

Showing schema in neo4j console

Upvotes: 2

Related Questions