Create index on Relationship property

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

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

db.index.fulltext.createRelationshipIndex

Please refer -

https://neo4j.com/docs/cypher-manual/current/administration/indexes-for-full-text-search/

1 Like

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?

any answers on this?

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.

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

Hi @rajeevprasanna ,

Neo4j 4.3 has now released with Index on Relationship properties.

Refer -> https://neo4j.com/docs/cypher-manual/4.3/administration/indexes-for-search-performance/#administration-indexes-create-a-single-property-index-for-relationships

A simple demo -> http://www.dominickumar.com/blog/neo4j-4-3-relationship-index/