Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
12-04-2020 08:25 AM
Today I cannot create named constraint or index. I am getting following error.
Command - CREATE INDEX PersonBornIndex FOR (p:Person) ON (p.born)
Error-
Invalid input 'P': 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 PersonBornIndex FOR (p:Person) ON (p.born)"
12-04-2020 08:41 AM
I think the right syntax is:
CREATE INDEX PersonBornIndex ON :Actor(born)
also this does work:
CREATE INDEX PersonBornIndex IF NOT EXISTS FOR (p:Person) ON (p.born);
12-04-2020 08:45 AM
Above code is also not working. I am using Sandbox
Error - Invalid input 'P': 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 PersonBornIndex ON :Actor(born)"
12-04-2020 10:21 AM
Unfortunately, our sandboxes are still using Neo4j 3.5.
You will need to use the 3.5 Cypher syntax:
CREATE INDEX ON :Actor(born)
Index names were introduced in 4.0.
We hope to have 4.0 sandboxes available SOON!
Elaine
12-04-2020 10:55 AM
Ok, thanks for this information! I would recommend Neo4j to include such information in training documentation to avoid any confusions.
All the sessions of the conference are now available online