我使用 Titan 1.0.0 与cassandra后端和elasticsearch作为索引 . 我有用户顶点配置属性(userId,email,fullName等) . 其中一些属性在elasticsearch中配置为混合索引 . 现在我想使用以下方法将现有属性(例如,之前未包含在混合索引中的 previously configured 属性)添加到混合索引:
TitanManagement tm = graph.openManagement();
tm.addIndexKey(tm.getGraphIndex("users"), tm.getPropertyKey("age"));
tm.commit();
从现在开始,将额外的“age " property mapping is added to the elasticsearch. Each update of the " age " property of a user vertex add an " age”字段添加到elasticserch文档中 . 但是,为了在titan查询中正确使用此索引,我必须重新索引我的混合图索引 . 此时我的问题就出现了 . 提到titan文档,我需要执行以下步骤(使用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()
超时10分钟后收到的答案:
==>GraphIndexStatusReport[success=false, indexName='users', targetStatus=REGISTERED,
notConverged={age=INSTALLED, fullName=ENABLED, userId=ENABLED,
userRegisterDate=ENABLED, userGender=ENABLED, email=ENABLED},
converged={}, elapsed=PT10M0.173S]
现在,如果我尝试重新索引如下:
tm = graph.openManagement()
tm.updateIndex(tm.getGraphIndex("users"), SchemaAction.REINDEX).get()
tm.commit()
我收到错误:
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])
我有什么想法我做错了吗?