简体   繁体   中英

Neo4j and schema indexes on relationship properties

As far as I know, Neo4j doesn't support schema indexes on relationship properties right now. According to the following GitHub issue https://github.com/neo4j/neo4j/issues/7225 there is a big need in such indexes.

Is there any chance that Neo4j will introduce schema indexes in near future or this is a limitation in Neo4j architecture and can't be implemented at all?

PS

I know about Neo4j manual indexes for relationship properties but they also have some limitations versus schema indexes.

There should be no insurmountable reason why that capability cannot be added in the future.

In the meantime, if you want to use schema indexing, you can consider working around this by "reifying" the relationship type to a node label. That is, you can replace each such relationship with a node and 2 relationships.

In the following example, you would replace the FOO relationship type with a Foo node label and X and Y relationships. With the modified data model, you can create a schema index on Foo .

  • Before: (a)-[:FOO]->(b)
  • After: (a)-[:X]->(:Foo)-[:Y]->(b)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM