Multiple Indices on a single key, titan 1.0

74 views
Skip to first unread message

Jesse Bexten

unread,
Jun 1, 2016, 3:54:57 PM6/1/16
to Aurelius
We are running into an issue when creating mixed indices with elasticsearch as our indexing backend. I create a property key and then a mixed index creating that key. I then later create an additional index on the same property and execute a reindex operation. When waiting for the index status during reindex i get the following message in my log 

Some key(s) on index bylastNameDOBEmail do not currently have status ENABLED: lastName=INSTALLED,birthDate=INSTALLED,email=INSTALLED

Eventually this times out and the index keys never become enabled. 

Can a single property key exist in more than one index?

Please see code below:

buildMixedIndex('bylastNameDOBEmail',['lastName','birthDate','email'],g)
buildMixedIndex('lastName',['lastName'],g)
buildMixedIndex('firstName',['firstName'],g)
buildMixedIndex('email',['email'],g)
buildMixedIndex('birthDate',['birthDate'],g)
buildMixedIndex('zip',['zip'],g)
buildMixedIndex('vin',['vin'],g)

private static void buildMixedIndex(String name, List<String> properties, TitanGraph g){

   
TitanManagement mgmt = g.openManagement()

   
try{
       
if(!mgmt.containsGraphIndex(name)){
           
def indexBuilder = mgmt.buildIndex(name,Vertex.class)
            properties
.each{
               
def key =  mgmt.getPropertyKey(it)
               
if(!key){
                   
logger.info("Creating key " + it)
                    key
= mgmt.makePropertyKey(it).dataType(String.class).make()
               
}
                indexBuilder
.addKey(key)
           
}
            indexBuilder
.buildMixedIndex(INDEX_NAME)
            mgmt
.commit()
            g
.tx().commit()
           
logger.info("Created mixed index: " + name + ", on properties: " + properties.toString())
           
ManagementSystem.awaitGraphIndexStatus(g,name).status(SchemaStatus.ENABLED).call()
       
}

       
def indexSize = g.indexQuery(name,"v."+properties[0]+":*").limit(100).vertices().size()
       
logger.info(name + " index size is " + indexSize)
       
if(indexSize < 100){ //index is empty so reindex, should only get hit when creating new indices or when recovering elasticsearch
            logger.info('Reindexing '+ name)
            mgmt
= g.openManagement()
           
def i = mgmt.getGraphIndex(name)
            mgmt
.updateIndex(i, SchemaAction.REINDEX)
            mgmt
.commit()
            g
.tx().commit()
           
// Enable the index
            ManagementSystem.awaitGraphIndexStatus(g,name).status(SchemaStatus.ENABLED).call()
       
}
   
} finally {
       
if(mgmt.isOpen())
            mgmt
.commit()
        g
.tx().commit()
   
}
}



Jesse Bexten

unread,
Jun 2, 2016, 2:37:15 PM6/2/16
to Aurelius
One thing to note in case it was confusing, all other indices other than 'bylastNameDOBEmail' had already been created. I then added the call to create 'bylastNameDOBEmail' and got the failure.

Jesse Bexten

unread,
Jun 24, 2016, 2:39:42 PM6/24/16
to Aurelius
Sorry for the bump, we are nearing a production date with titan backing our application. Any ideas or suggestions on index management would be helpful.
Reply all
Reply to author
Forward
0 new messages