I am using Titan 1.0.0 with cassandra backend and elasticsearch as index. I have user vertices with configured properties (userId, email, fullName... etc). Some of those properties are configured as mixed index in elasticsearch. Now I want to add an existed property (e.g. a previously configured property that was not included in the mixed index before) to the mixed index using:
TitanManagement tm = graph.openManagement();
tm.addIndexKey(tm.getGraphIndex("users"), tm.getPropertyKey("age"));
tm.commit();
From now additional "age" property mapping is added to the elasticsearch. Each update of the "age" property of a user vertex add an "age" field to the elasticserch document. However in order to use this index properly in titan queries I must reindex my mixed graph index. At this point my problem starts. Referred to titan documentation, I need to do the following steps (using Gremlin):
import com.thinkaurelius.titan.graphdb.database.management.ManagementSystem
// Rollback or commit transactions on the graph which predate the index definition
graph.tx().rollback()
// Block until the SchemaStatus transitions from INSTALLED to REGISTERED
ManagementSystem.awaitGraphIndexStatus(graph, "users")
.status(SchemaStatus.REGISTERED)
.timeout(10, ChronoUnit.MINUTES) // set timeout to 10
.call()
After 10 minute timeout the answer that was received:
==>GraphIndexStatusReport[success=false, indexName='users', targetStatus=REGISTERED,
notConverged={age=INSTALLED, fullName=ENABLED, userId=ENABLED,
userRegisterDate=ENABLED, userGender=ENABLED, email=ENABLED},
converged={}, elapsed=PT10M0.173S]
And now, if I try to reindex as follows:
tm = graph.openManagement()
tm.updateIndex(tm.getGraphIndex("users"), SchemaAction.REINDEX).get()
tm.commit()
I receive the error:
WARN com.thinkaurelius.titan.graphdb.olap.job.IndexRepairJob - Index users has key age in an invalid status INSTALLED
ERROR com.thinkaurelius.titan.diskstorage.keycolumnvalue.scan.StandardScannerExecutor - Exception trying to setup the job:
com.thinkaurelius.titan.core.TitanException: The index users is in an invalid state and cannot be indexed. The following index keys have invalid status: age has status INSTALLED (status must be one of [REGISTERED, ENABLED])
Any ideas what I am doing wrong?
.get()
aftertm.updateIndex(tm.getGraphIndex("users"), SchemaAction.REINDEX)
? You missed that part from the example provided in the documentation. – jbmusso.get()
method call. Just copy/paste mistake, edited my questions. – OctopusSD