Graph index
Description
The Graph index action (previously Neo4j index) creates or drops indexes on node or relationship properties in a graph database, in the syntax of the database: Neo4j, Memgraph, FalkorDB or Apache AGE.
For similar operations on constraints, check the Graph constraint action.
Options
-
Graph database connection : The name of the graph database connection to update indexes on
-
Index updates to perform: You can specify your list of index updates here
-
Update type : CREATE or DROP
-
Type of object to index on: NODE or RELATIONSHIP
-
Index name: optional but recommended name for your index
-
Object name: the label of the node or relationship you want to update an index for
-
Properties (, separated): the comma separated list of node or relationship properties to index
-
Index type: RANGE for a regular property index (the default), VECTOR for a vector index
-
Vector dimensions: VECTOR only, the number of numbers in each vector, for example 768 for
nomic-embed-text -
Vector similarity: VECTOR only, COSINE (the default) or EUCLIDEAN
-
Vector capacity: VECTOR on Memgraph only, the number of vectors to reserve room for, 1000 when empty
-
The index name, object name, properties, vector dimensions and vector capacity can be variables, for example ${CHUNK_INDEX} to keep a test and a production index apart.
The action resolves them before it builds the statement, for create and drop, and the Cypher preview shows the resolved values.
Use the same variable for the index name in Graph vector search.
Databases
| Database | Range index | Vector index |
|---|---|---|
Neo4j |
Nodes and relationships |
Nodes and relationships |
Memgraph |
Nodes and relationships |
Nodes and relationships |
FalkorDB |
Nodes and relationships |
Nodes and relationships |
Apache AGE |
Nodes, with a name |
No |
Amazon Neptune, Gremlin |
No |
No |
On Apache AGE an index is a PostgreSQL index on the table of the label, created and dropped with SQL. The action creates the label first when there are no nodes with it yet, so the index can be created before the data is loaded.
Vector indexes
A vector index is on a single property holding embeddings, see Vectors and embeddings. Neo4j, Memgraph and FalkorDB have vector indexes; the action refuses them on the other databases.
| Database | Notes |
|---|---|
Neo4j |
Vector indexes on nodes and relationships, |
Memgraph |
Vector indexes on nodes and, from Memgraph 3, relationships ( |
FalkorDB |
Vector indexes on nodes and relationships, identified by label or relationship type and property like its other indexes. |
For a vector index on relationships set the type of object to RELATIONSHIP and the object name to the relationship type.
Search it with the Graph vector search transform, Search set to RELATIONSHIP.
Show Cypher Preview
The action dialog includes a "Show Cypher" button that displays a preview of the
Cypher statements that will be executed for creating or dropping indexes. This preview
shows the exact CREATE INDEX or DROP INDEX statements before execution.
The preview is read-only and helps you verify the index operations that will be performed.
Result
What this action passes on to the next action. See Action results for how results travel through a workflow.
| Result | Value |
|---|---|
True |
All the index updates ran, with 0 errors. The drops run first, then the creates. An empty list is also true. An empty Index name is only fine where the database doesn’t use names: to create a RANGE index on Neo4j, which then names the index, for range indexes on Memgraph, and for every index on FalkorDB. In the other cases it stops the workflow, see the WARNING. |
False |
The action is never false: see the WARNING. |
Result files |
Passed on unchanged. |
Result rows |
Passed on unchanged. |
| When an index update can’t be done, the workflow stops with an error and no hop from the action is followed: the Graph database connection is empty, doesn’t exist or can’t be reached, an update has no Update type, an index is created without Object name or Properties (on Memgraph and FalkorDB, which identify an index by them, also when it is dropped, except a Memgraph vector index), a VECTOR index is created with Vector dimensions that are empty, not a number or not positive (a drop doesn’t need them), Index name is empty where the database needs one (to drop an index or create a vector index on Neo4j, for a vector index on Memgraph, for any index on Apache AGE), or the database refuses the statement. The updates before it stay done, the ones after it are not run. |
On Neo4j and Apache AGE the action creates with IF NOT EXISTS and drops with IF EXISTS. Creating an index that already exists, or dropping one that doesn’t, does nothing and the action is still true. On Neo4j this is also the case when an index with the same name exists on another label or property, or an equivalent one exists with another name: nothing is created.
|