Can't create fulltext index in neo4j 4.2.X

Viewed 632

According to this documentation, in neo4j 4.2.X one can create freetext indexes as follows:

CREATE FULLTEXT INDEX my_index
FOR (n:MYNODETYPE) ON EACH (n.label)

Yet when I run this query, I get the following error message:

Invalid input 'I': expected whitespace, comment, '=', node labels, MapLiteral, a parameter, a parameter (old syntax), a relationship pattern, ',', FROM GRAPH, USE 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 17 (offset: 16)) "CREATE FULLTEXT INDEX my_index"

I've seen this related post which had a similar error, but the accepted answer says that the syntax I'm using should be valid in neo4j 4.X. I'm running neo4j 4.2.7, community edition (confirmed by calling dbms.components()).

What am I doing wrong?

1 Answers

I am looking at the docs and they seem a bit different. Try the following:

CREATE FULLTEXT INDEX titlesAndDescriptions FOR (n:MYNODETYPE) ON EACH [n.label]

It seems the above syntax is for Neo4j 4.3+. Syntax for previous versions of Neo4j is as follows:

CALL db.index.fulltext.createNodeIndex("titlesAndDescriptions", ["MyNodeType"], ["label"])
Related