# How to export entire neo4j database to cypher scripts?

**URL:** <https://community.neo4j.com/t/how-to-export-entire-neo4j-database-to-cypher-scripts/63116>\
**Category:** Import / Export\
**Created:** [July 2, 2023, 6:48am UTC](https://community.neo4j.com/t/how-to-export-entire-neo4j-database-to-cypher-scripts/63116 "2023-07-02T06:48:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sahilf2085](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/sahilf2085/32/29024_2.png) [@sahilf2085](https://community.neo4j.com/u/sahilf2085)\
**Post date:** [July 2, 2023, 6:48am UTC](https://community.neo4j.com/t/how-to-export-entire-neo4j-database-to-cypher-scripts/63116/1 "2023-07-02T06:48:38Z")

</div>

Hi

Im not able to export neo4j db to cypher script file.

I executed this statement : CALL apoc.export.cypher.all("all.cypher", {  
format: "cypher-shell",  
useOptimizations: {type: "UNWIND\_BATCH", unwindBatchSize: 20}  
})  
YIELD file, batches, source, format, nodes, relationships, properties, time, rows, batchSize  
RETURN file, batches, source, format, nodes, relationships, properties, time, rows, batchSize;

And Im getting this error  
Neo.ClientError.Procedure.ProcedureCallFailed: Failed to invoke procedure `apoc.export.cypher.all`: Caused by: java.lang.IllegalStateException: This is a multi-token index, which has more than one label. Call the getLabels() method instead.

I tried one more apoc statement : CALL apoc.export.cypher.all(null,{streamStatements:true,batchSize:100}) YIELD cypherStatements RETURN cypherStatements

But this doesnt give any console output

Please help!

---

<div class="post-metadata">

**Author:** ![bennu\_neo](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/bennu_neo/32/27616_2.png) [@bennu\_neo](https://community.neo4j.com/u/bennu_neo)\
**Post date:** [July 2, 2023, 9:18am UTC](https://community.neo4j.com/t/how-to-export-entire-neo4j-database-to-cypher-scripts/63116/2 "2023-07-02T09:18:04Z")

</div>

Hi @sahilf2085

Which apoc version are you using?

Can you share the indexes `SHOW INDEXES` present on your database at the moment?

---

<div class="post-metadata">

**Author:** ![sahilf2085](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/sahilf2085/32/29024_2.png) [@sahilf2085](https://community.neo4j.com/u/sahilf2085)\
**Post date:** [July 2, 2023, 9:46am UTC](https://community.neo4j.com/t/how-to-export-entire-neo4j-database-to-cypher-scripts/63116/3 "2023-07-02T09:46:11Z")

</div>

Hi @bennu_neo

Apoc version is 3.5.0.2

---

<div class="post-metadata">

**Author:** ![glilienfield](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/glilienfield/32/27534_2.png) [@glilienfield](https://community.neo4j.com/u/glilienfield)\
**Post date:** [July 2, 2023, 1:44pm UTC](https://community.neo4j.com/t/how-to-export-entire-neo4j-database-to-cypher-scripts/63116/4 "2023-07-02T13:44:24Z")

</div>

```auto

Caused by: java.lang.IllegalStateException: This is a multi-token index, which has more than one label. 

```

Based on this it looks like you have an index with multiple labels. I do know know of these, which seems to be true considering you got an illegal state error. Can use show all your indexes as @bennu_neo suggested?

---

<div class="post-metadata">

**Author:** ![sahilf2085](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/sahilf2085/32/29024_2.png) [@sahilf2085](https://community.neo4j.com/u/sahilf2085)\
**Post date:** [July 2, 2023, 5:59pm UTC](https://community.neo4j.com/t/how-to-export-entire-neo4j-database-to-cypher-scripts/63116/5 "2023-07-02T17:59:55Z")

</div>

Hi @glilienfield @bennu_neo

This issue was resolved by dropping the db index : CALL db.index.fulltext.drop  
I was able to export the whole database (neo4j community edition 3.5.3 edition) to cypher script.

Now Im facing issue in importing the script in neo4j 5.9 community edition.

Statements like **CREATE INDEX FOR :`LabelName`(`fieldName`)** & **CALL db.awaitIndex(':`LabelName`(`FieldName`)')** are resulting in error. Im assuming there are syntax changes in the latest edition.

What kind of changes has to be made to the exported script?

PS : Initially it was Create Index ON . I changed it to Create Index For. Similar change to Create Constraint On & Drop Constraint On
