【发布时间】:2016-11-12 17:10:32
【问题描述】:
我使用 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”属性映射添加到 elasticsearch。用户顶点的“age”属性的每次更新都会在 elasticserch 文档中添加一个“age”字段。但是,为了在泰坦查询中正确使用此索引,我必须重新索引我的混合图索引。此时我的问题开始了。参考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])
任何想法我做错了什么?
【问题讨论】:
-
您可以尝试在
tm.updateIndex(tm.getGraphIndex("users"), SchemaAction.REINDEX)之后将调用链接到.get()吗?您错过了文档中提供的示例中的那部分。 -
@jbmusso 是的,我尝试使用
.get()方法调用。只需复制/粘贴错误,编辑我的问题。
标签: elasticsearch titan gremlin