# Create multiple index in one cypher statement?

**URL:** <https://community.neo4j.com/t/create-multiple-index-in-one-cypher-statement/29325>\
**Category:** Neo4j Graph Platform\
**Created:** [November 20, 2020, 1:22am UTC](https://community.neo4j.com/t/create-multiple-index-in-one-cypher-statement/29325 "2020-11-20T01:22:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lingvisa](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/lingvisa/32/8150_2.png) [@lingvisa](https://community.neo4j.com/u/lingvisa)\
**Post date:** [November 20, 2020, 1:22am UTC](https://community.neo4j.com/t/create-multiple-index-in-one-cypher-statement/29325/1 "2020-11-20T01:22:41Z")

</div>

According to this:

> <https://stackoverflow.com/questions/20894532/multiple-create-index-on-in-one-cypher-query>

Creating multiple indexes in one cypher statement is possible. But I tried, it is still invalid syntax. Is this supported or not?

```auto
CREATE INDEX effect_name FOR (n:Effect) on (n._name)
CREATE INDEX beauty_name FOR (n:Beauty) on (n._name)

```

---

<div class="post-metadata">

**Author:** ![Cobra](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/cobra/32/35243_2.png) [@Cobra](https://community.neo4j.com/u/Cobra)\
**Post date:** [November 20, 2020, 9:04am UTC](https://community.neo4j.com/t/create-multiple-index-in-one-cypher-statement/29325/2 "2020-11-20T09:04:33Z")

</div>

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):

```auto
CREATE INDEX effect_name FOR (n:Effect) on (n._name)
UNION
CREATE INDEX beauty_name FOR (n:Beauty) on (n._name)

```

Regards,  
Cobra

---

<div class="post-metadata">

**Author:** ![dana\_canzano](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/dana_canzano/32/27392_2.png) [@dana\_canzano](https://community.neo4j.com/u/dana_canzano)\
**Post date:** [November 20, 2020, 1:03pm UTC](https://community.neo4j.com/t/create-multiple-index-in-one-cypher-statement/29325/3 "2020-11-20T13:03:06Z")

</div>

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 [neo4j - Multiple CREATE INDEX ON in one cypher query - Stack Overflow](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

---

<div class="post-metadata">

**Author:** ![lingvisa](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/lingvisa/32/8150_2.png) [@lingvisa](https://community.neo4j.com/u/lingvisa)\
**Post date:** [November 20, 2020, 5:33pm UTC](https://community.neo4j.com/t/create-multiple-index-in-one-cypher-statement/29325/4 "2020-11-20T17:33:59Z")

</div>

Not too much gain, but just save a few lines of code.
