添加现有属性后,无法重新编制titan 1.0.0混合索引

时间:2016-07-10 18:47:31

标签: elasticsearch titan gremlin

我使用 Titan 1.0.0 ,使用cassandra后端和elasticsearch作为索引。我有用户顶点配置属性( userId,email,fullName ... etc )。其中一些属性在elasticsearch中配置为混合索引。现在我想使用以下方法将一个已存在的属性(例如之前未配置的混合索引中的以前配置的属性)添加到混合索引中:

 TitanManagement tm = graph.openManagement();
 tm.addIndexKey(tm.getGraphIndex("users"), tm.getPropertyKey("age"));
 tm.commit();

从现在开始额外的" 年龄"属性映射添加到elasticsearch。每次更新" 年龄"用户顶点的属性添加" age "弹性填充文档的字段。但是,为了在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])

任何想法我做错了什么?

1 个答案:

答案 0 :(得分:0)

您无法将新属性添加到现有索引。检查docs