如何查找以cassandra为数据存储的Titan/Rexster图形数据库上创建的索引信息



我有一个Rexster/Titan+Cassandra配置。我已经创建了顶点上的唯一索引属性。如何验证索引是否已正确创建?以及检查其他属性,如唯一性和关于创建的索引的任何其他信息?

当您使用Titan时,您可以使用TitanManagement API:

gremlin> g = TitanFactory.open('conf/titan-berkeleydb-es.properties')
==>titangraph[berkeleyje:/home/smallette/jvm/titan-0.5.4-hadoop1/conf/../db/berkeley]
gremlin> GraphOfTheGodsFactory.load(g)
==>null
gremlin> mgmt = g.getManagementSystem()
==>com.thinkaurelius.titan.graphdb.database.management.ManagementSystem@6ac756b
mgmt.getGraphIndexes(Vertex.class).collect{[it.name,it.fieldKeys.collect{it.cardinality}]}
==>[name, [SINGLE]]
==>[vertices, [SINGLE]]
gremlin> mgmt.rollback()
==>null

您可以像我在Gremlin控制台中那样发出查询,也可以简单地向Rexster的Gremlin扩展发出相同的查询来获得结果。请务必调用rollback(或commit)以关闭管理API事务,尤其是在使用Rexster的情况下(Rexster不自动管理这些事务)。

最新更新