apoc.schema.relationship.indexExistsFunction
|
Syntax |
|
||
Description |
Returns a |
||
Arguments |
Name |
Type |
Description |
|
|
The relationship type to check for an index on. |
|
|
|
The property names to check for an index on. |
|
Returns |
|
||
Example
Given this index:
CREATE INDEX knows_since FOR ()-[r:KNOWS]-() ON (r.since);
CREATE INDEX purchased_composite FOR ()-[r:PURCHASED]-() ON (r.date, r.amount);
The following query checks whether an index exists on the since property of KNOWS relationships:
RETURN apoc.schema.relationship.indexExists('KNOWS', ['since']) AS indexExists
| indexExists |
|---|
true |
Passing a property that is not indexed, or a type with no index at all, returns false:
RETURN apoc.schema.relationship.indexExists('KNOWS', ['unknown']) AS indexExists
| indexExists |
|---|
false |
Composite indexes require all property names to be supplied in the correct order:
RETURN apoc.schema.relationship.indexExists('PURCHASED', ['date', 'amount']) AS indexExists
| indexExists |
|---|
true |