Aerodynamika
Aerodynamika

Reputation: 8413

Relationship Labels and Index in Neo4J

It's possible to label the nodes in the new Neo4J 2.0.1, but does that same labelling work on relationships? If I have a relationship of the type :TO, can I create an index on its "statement" property like that?

 CREATE INDEX ON :TO(statement)

Thank you!

Upvotes: 12

Views: 11028

Answers (1)

Stefan Armbruster
Stefan Armbruster

Reputation: 39915

a) you cannot have labels on relationships. A relationship has one type (which can be thought of kind of label). If you need multiple labels, you just create multiple relationships with different types

b) schema indexes on relationships are not possible. A graph query typically starts at nodes and not at relationships since nodes are the "things" in your domain. Starting at a relationship is IMHO often a indication to rethink your graph model. If you're still convinced you need relationship indexing, you can go with legacy indexing.

Upvotes: 9

Related Questions