Reputation: 3921
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
Upvotes: 0
Views: 104
Reputation: 3921
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()
Upvotes: 1