【问题标题】:Unable to reindex titan 1.0.0 mixed index after adding existed property to it在添加现有属性后无法重新索引 Titan 1.0.0 混合索引
【发布时间】: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


【解决方案1】:

您不能向现有索引添加新属性。检查docs

【讨论】:

  • 根据 Titan v1.0.0 文档,this can be done for Mixed Index.
  • 在哪里?您能否引用说明您可以将新属性添加到现有混合索引的部分?
  • @MTA 请查看 Titan 1.0.0 文档的 8.1.2.1 部分:“如果属性键已被使用,添加键需要执行 重新索引过程以确保索引包含所有以前添加的元素。"
  • @OctopusES,这意味着您可以将现有属性添加到新索引。但这并不意味着您可以将任何属性添加到现有索引。
猜你喜欢
  • 2016-10-20
  • 1970-01-01
  • 2021-09-19
  • 1970-01-01
  • 1970-01-01
  • 2016-06-20
  • 1970-01-01
  • 2016-09-08
  • 2015-12-13
相关资源
最近更新 更多