Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
11-19-2020 05:22 PM
According to this:
Creating multiple indexes in one cypher statement is possible. But I tried, it is still invalid syntax. Is this supported or not?
CREATE INDEX effect_name FOR (n:Effect) on (n._name)
CREATE INDEX beauty_name FOR (n:Beauty) on (n._name)
Solved! Go to Solution.
11-20-2020 09:33 AM
11-20-2020 01:04 AM
Hello @lingvisa
This syntax is only working on Neo4j browser if you enable multi-statement query editor as said on the stack overflow post.
If you want to use the BOLT protocol for example, you should be able to cheat (not sure it's working right):
CREATE INDEX effect_name FOR (n:Effect) on (n._name)
UNION
CREATE INDEX beauty_name FOR (n:Beauty) on (n._name)
Regards,
Cobra
11-20-2020 05:03 AM
but is there anything to be gained by doing such.
Presumably creating an index on a label / property is a rare experience in that I might create said index today on :Person(name) and then the index is there for good such that I never need to recreate etc. I'm not sure I understand see the need/benefit of creating N indexes in one statement/transaction. Also it should be noted that a create index
will return immediately for the end user but the index is then populated in the background and this could take N seconds/minutes depending on the volume of data.
Finally, the originally referenced url https://stackoverflow.com/questions/20894532/multiple-create-index-on-in-one-cypher-query was originally authored almost 7 years ago. It may still be valid but generally the date when authored should be considered
11-20-2020 09:33 AM
Not too much gain, but just save a few lines of code.
All the sessions of the conference are now available online