Neo4j: Indexes Cheat Sheet

Indexes for search performance

CommandDescription
CREATE INDEX [index_name] FOR (n:LabelName) ON (n.propertyName)Create a single-property index.
CREATE INDEX [index_name] FOR (n:LabelName) ON (n.propertyName_1, n.propertyName_2, … n.propertyName_n)Create a composite index.
DROP INDEX index_nameDrop an index
CALL db.indexesList all indexes in the database.
DROP INDEX ON :LabelName(propertyName)Drop a single-property index without specifying a name.
DROP INDEX ON :LabelName (n.propertyName_1, n.propertyName_2, … n.propertyName_n)Drop a composite index without specifying a name.

Indexes for full-text search

UsageProcedure
Create full-text node indexdb.index.fulltext.createNodeIndex
Create full-text relationship indexdb.index.fulltext.createRelationshipIndex
List available analyzersdb.index.fulltext.listAvailableAnalyzers
Use full-text node indexdb.index.fulltext.queryNodes
Use full-text relationship indexdb.index.fulltext.queryRelationships
Drop full-text indexdb.index.fulltext.drop
Eventually consistent indexesdb.index.fulltext.awaitEventuallyConsistentIndexRefresh

Leave a Reply

Your email address will not be published. Required fields are marked *