cancel
Showing results for 
Search instead for 
Did you mean: 

Join the community at Nodes 2022, our free virtual event on November 16 - 17.

Create index on Relationship property

rajeevprasanna
Node Clone

I read somewhere that Neo4j latest version supports indexing on relationship properties.

Can someone guide me how can we create index on relationship property?
please share syntax of it and limitations

1 ACCEPTED SOLUTION

dominicvivek06
Graph Fellow

Neo4j currently support Full Text Index on Relationships types and properties.

db.index.fulltext.createRelationshipIndex

Please refer -

View solution in original post

7 REPLIES 7

dominicvivek06
Graph Fellow

Neo4j currently support Full Text Index on Relationships types and properties.

db.index.fulltext.createRelationshipIndex

Please refer -

If i created index on relationship property, will queries use those indexes implicitly?

I have query like below where querying is done on relationship property.

optional match (u)-[r:Relationship]-() where r.id = 123
 	return u

How can this be optimised with full index search or any other way?

rajeevprasanna
Node Clone

any answers on this?

clem
Graph Steward

Try experimenting with the query with and without the index.

Then, use the PROFILE or EXPLAIN commands to see if the index helps or hurts.

My guess is that it would help.

rajeevprasanna
Node Clone

I need to query index relationship directly to use it. thankx

CALL db.index.fulltext.createRelationshipIndex("Rel_index_name", ["Relationship_Name"], ["Relationship_Property_Name"])

CALL db.index.fulltext.queryRelationships("Rel_index_name", "<search value>") YIELD relationship,score

dominicvivek06
Graph Fellow

Hi @rajeevprasanna ,

Neo4j 4.3 has now released with Index on Relationship properties.

Refer -> Indexes for search performance - Neo4j Cypher Manual

A simple demo -> Neo4j 4.3 Relationship Index – Dominic KUMAR's blog