0
votes

This is what I am doing. I really don't know what I am doing wrong

CREATE INDEX index_user FOR (n:User) ON (n.id, n.username, n.email)

The Output is

Invalid input 'i': expected whitespace, comment, ON, '=', node labels, MapLiteral, a parameter, a parameter (old syntax), a relationship pattern, ',', FROM GRAPH, CONSTRUCT, LOAD CSV, START, MATCH, UNWIND, MERGE, CREATE UNIQUE, CREATE, SET, DELETE, REMOVE, FOREACH, WITH, CALL, RETURN, UNION, ';' or end of input (line 1, column 14 (offset: 13)) "CREATE INDEX index_user FOR (n:User)"

1
Are you sure you are running this exact command? I tried it in a fresh Neo4j 4.0.3 docker instance and it completes without errors: »Added 1 index, completed after 41 ms.«knittl
I copied the command right off. I am using Graphene db. I guess they use some an older version of Neo4j. ThanksEmmanuel Sunday

1 Answers

1
votes

The syntax you are using was added to neo4j 4.x. It is not supported in older versions of neo4j.

In older versions that support composite indexes, like neo4j 3.5, the syntax for creating your index would be:

CREATE INDEX ON :User(id, username, email)

Note: This older syntax is currently still supported in version 4.0.4, but deprecated.