Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
05-04-2020 11:22 AM
3.5.17
create index on:Brand(name)
create index on:Brand(type)
Is there a way to combine these two into one cypher command?
05-04-2020 11:48 AM
You can not create multiple index with on Create statement.
However multiple cypher statements can run in one go by Enable multi statement query editor
05-04-2020 12:16 PM
with self._driver.session() as session:
constraint_command = "CREATE CONSTRAINT ON (n:" + label + ") ASSERT n.ID IS UNIQUE"
index_command_1 = "CREATE index on:" + label + "(type)"
index_command_2 = "CREATE index on:" + label + "(name)"
index_command_3 = "CREATE index on:" + label + "(channel)"
session.write_transaction(
lambda tx:
tx.run(constraint_command))
session.write_transaction(
lambda tx:
tx.run(index_command_1))
session.write_transaction(
lambda tx:
tx.run(index_command_2))
session.write_transaction(
lambda tx:
tx.run(index_command_3))
Can the 3 tx.run(index_command_x) be merged into one run?
All the sessions of the conference are now available online