Question

I am using py2neo to upload the initial data into neo4j and am using batches to make it faster. I was wondering if there is a way to create indexes too using batches.

Thanks

Was it helpful?

Solution

I found a good solution for this. The WriteBatch() has the method add_index_node eg,

batch = neo4j.WriteBatch(graph_db)  
a = batch.create(node(name='Alice'))  
batch.add_index_node("people","name","alice",a)  
batch.submit()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top