查看索引
mgmt = graph.openManagement()
# 查看全部点索引
mgmt.getGraphIndexes(Vertex.class)
# 查看全部边索引
mgmt.getGraphIndexes(Edge.class)
# 查看某个索引的状态
mgmt.getGraphIndex('indexname').getIndexStatus(mgmt.getPropertyKey('J010006'))
索引状态由 INSTALLED 改为 REGISTERED
# 回滚事务
graph.getOpenTransactions().forEach{tx->tx.rollback()}
# 更改之前必须关闭所有 instance,否则更改不成功
mgmt = graph.openManagement()
# all open instances
mgmt.getOpenInstances()
==>7f0001016161-dunwich1(current)
==>7f0001016161-atlantis1
# 删除一个 instance 带有current的是当前的
mgmt.forceCloseInstance('7f0001016161-atlantis1')
mgmt.commit()
mgmt = graph.openManagement()
mgmt.updateIndex(mgmt.getGraphIndex("${indexName}"), SchemaAction.REGISTER_INDEX).get()
# 也可以使用这个 API 效果一样
ManagementSystem.awaitGraphIndexStatus(graph, '${indexName}').call()
# 查询状态
mgmt.getGraphIndex('${indexName}').getIndexStatus(mgmt.getPropertyKey('${prop}'))
mgmt.commit()
索引reindex
# reindex 速度非常慢,即使reindex完成后再进行reindex速度也没有明显减少
mgmt = graph.openManagement()
i = mgmt.getGraphIndex('indexName')
mgmt.updateIndex(i, SchemaAction.REINDEX).get()
mgmt.commit()
# 使用MapReduce时,需要export HADOOP_HOME等