cassandragraph-databasestitanrexster

How to find the information about index created on Titan/Rexster graph database with cassandra as datastore


I have a Rexster/Titan + Cassandra configuration. I have created unique index over vertex properties. How can I verify the index has created properly? and also to check the other properties such as uniqueness and any other information about the created index?


Solution

  • As you are using Titan, you can use the 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
    

    You can either issue the query as I did from the Gremlin Console or you should be able to simply issue the same query like that to Rexster's Gremlin Extension to get that result. Be sure to call rollback (or commit) to close the management API transaction, especially if using Rexster (Rexster doesn't auto-manage those).