0

I'm using Neo4j with Bolt and the Neo4j driver in Java. When I tried to run the following command:

DROP INDEX ON :SingleBoardComputer(id.id)

Note that the name of the property is actually "id.id" (basically with a dot).

I have the following error:

Neo.ClientError.Statement.SyntaxError: Invalid input '\': expected whitespace or a list of property key names (line 1, column 36 (offset: 35))
"DROP INDEX ON :SingleBoardComputer(id.id)"

Is there any way to drop an index using the driver?

I'm using Neo4j 3.3.5 and the neo4j driver 1.6.1

I'm surprised because I can create the index without problems.

Thanks

Davide D'Alto
  • 7,421
  • 2
  • 16
  • 30
  • What version of neo4j are you using? It should not have been possible for `CREATE INDEX ON :SingleBoardComputer(id.id)` to have worked, since the dot in "id.id" is not legal in that context. Also, a node property value cannot be a map, so "id.id" would not make sense anyway. – cybersam May 21 '18 at 17:54
  • It is possible, you just have to escape the characters using '`' – Davide D'Alto May 21 '18 at 18:07
  • Please correct your question, then, to add that very important special information. Or, perhaps you should be using `id.id` in your DROP clause. – cybersam May 21 '18 at 18:09
  • I don't see how the question is wrong. The problem is that I have created an index on a property with the character '.' in the name. If you try to call the DROP INDEX command on that specific index it won't work, unless you escape the name of the property. What's wrong about the question? – Davide D'Alto May 21 '18 at 18:13
  • `id.id` has a very different meaning from \`id.id\`, and the latter is very unusal and unexpected. So, it would have been more accurate (and helpful to answerers) to indicate that you had created the index using \`id.id\` instead of just saying that you created the index with no problems. – cybersam May 21 '18 at 19:52
  • Perhaps, but downvoting the question for this reason seems way to harsh considering that the error would be completely different if the problem was about not having the index or referring to the wrong field. – Davide D'Alto May 22 '18 at 07:48
  • Neither of those issues seemed applicable. You said the index existed, and yet `:SingleBoardComputer(id.id)` would have caused a syntax error -- both when creating and dropping the index. So, the question is very confusing. In future, your questions should show the actual query that you tried. – cybersam May 22 '18 at 17:13

1 Answers1

2

The solution is to escape the field:

DROP INDEX ON :SingleBoardComputer(`id.id`)
Davide D'Alto
  • 7,421
  • 2
  • 16
  • 30