Dear Neo4j Community,
I have a question about Neo4j indexes and could not find the answer anywhere else and hope this is the right category for this as I thought it might be a newbie question. I am using Neo4j Sandbox and the Recommendations dataset.
In the sandbox the syntax
CREATE INDEX Index_Name FOR (n:Label) ON (n.property)
does not seem to work whereas the syntax
CREATE INDEX ON :Label(property)
seems to work. In particular, I created a new label and wanted to introduce an index with
CREATE INDEX Test_index FOR (n:NewLabel) ON (n.name)
which gives me the error
Invalid input 'T': 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 Test_index FOR (n:NewLabel) ON (n.name)"
I really don't know what would be wrong with this as it is just like in the Graph Academy described or am I missing something here? However, if I use
CREATE INDEX ON :NewLabel(name)
this works perfectly fine and creates and index. Because of this it won't let me create named indexes.
Thanks a lot for any help on this.