Andna
Andna

Reputation: 6689

Neo4j and spring-data-neo4j - importing large datasets

I am using Neo4j database with spring-data-neo4j. Now, I want to import pretty large datasets so I looked into the capabilities of neo4j for batch insertions.

After my research I found out about:

  1. BatchInserter for embedded database: http://docs.neo4j.org/chunked/stable/batchinsert.html and Michael Hunger project that uses it: https://github.com/jexp/batch-import/
  2. REST Batch endpoint: http://docs.neo4j.org/chunked/stable/rest-api-batch-ops.html which allows to send multiple operations in single request (so multiple operations are executed in one transaction).

Now, I am wondering if it is possible to somehow use the repository feature of spring-data-neo4j for batch inserts, because even the method save(Iterable<U> entities) in AbstractGraphRepository just iterates through every element and invokes save for one entity:

@Override
@Transactional
public <U extends T> Iterable<U> save(Iterable<U> entities) {
    for (U entity : entities) {
        save(entity);
    }
    return entities;
}

Upvotes: 2

Views: 1685

Answers (1)

Michael Hunger
Michael Hunger

Reputation: 41676

Right now there is no official support for batch insertion.

But you can try something like this: http://code.paananen.fi/2012/04/05/neo4j-batchinserter-and-spring-data-for-neo4j/

It is using SDN versions pre 3.0 though

Upvotes: 1

Related Questions