apoc.schema.node.indexExists

Function

apoc.schema.node.indexExists(labelName String, propertyName [String]) - returns a boolean depending on whether or not an index exists for the given node label with the given property names.

Signature

apoc.schema.node.indexExists(labelName :: STRING?, propertyName :: LIST? OF STRING?) :: (BOOLEAN?)

Input parameters

Name Type Default

labelName

STRING?

null

propertyName

LIST? OF STRING?

null

Usage Examples

The examples in this section are based on a database that has applied the following constraints:

CREATE CONSTRAINT personName FOR (person:Person)
REQUIRE person.name IS UNIQUE;

CREATE CONSTRAINT userId FOR (user:User)
REQUIRE user.id IS UNIQUE;

CREATE INDEX personCity FOR (person:Person)
ON (person.city);
RETURN apoc.schema.node.indexExists("Person", ["name"]) AS output;
Table 1. Results
output

TRUE

RETURN apoc.schema.node.indexExists("Person", ["city"]) AS output;
Table 2. Results
output

TRUE