How to export entire neo4j database to cypher scripts?

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!

Hi @sahilf2085

Which apoc version are you using?

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

Hi @bennu_neo

Apoc version is 3.5.0.2


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?

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