【问题标题】:Unable to add mixed index in Titan无法在 Titan 中添加混合索引
【发布时间】:2016-10-20 02:13:16
【问题描述】:

我想在 Titan 中创建一个混合索引,所以我使用了这些 gremlin 命令

graph.tx().rollback()
mgmt.buildIndex('deviceIndex',Vertex.class).addKey(serialNumber,Mapping.STRING.asParameter()).addKey(manufacturer,Mapping.STRING.asParameter()).addKey(clas,Mapping.STRING.asParameter()).addKey(description,Mapping.TEXT.asParameter()).addKey(fw_version,Mapping.STRING.asParameter()).addKey(hw_version,Mapping.STRING.asParameter()).addKey(latitude).addKey(longitude).addKey(accuracy).addKey(measure_datetime).buildMixedIndex("search")
mgmt.commit()
mgmt.awaitGraphIndexStatus(graph, 'deviceIndex').call()

我得到的输出是:

GraphIndexStatusReport[success=false, indexName='deviceIndex', targetStatus=REGISTERED, notConverged={device_longitude=ENABLED, device_latitude=ENABLED, device_description=ENABLED, device_class=ENABLED, device_serial_number=ENABLED, device_fw_version=ENABLED, device_accuracy=ENABLED, device_hw_version=ENABLED, device_manufacturer=ENABLED, measure_datetime=ENABLED}, 收敛={}, elapsed=PT1M0.234S]

你能告诉我为什么输出中有一个success=false。为什么查询失败?

=> 编辑

我使用了g.V().has('device_latitude', (float)343.2435).toList(),但它没有警告我正在遍历整个图表。但我无法从弹性搜索中搜索,即

GET http://localhost:9200/_search?pretty

结果

{
  "took" : 2,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "failed" : 0
  },
  "hits" : {
    "total" : 0,
    "max_score" : null,
    "hits" : [ ]
  }
}

【问题讨论】:

  • 您是否检查了索引以查看它是否正常工作?您是否尝试在 mgmt.commit() 之后使用 graph.tx().commit()?

标签: elasticsearch cassandra titan


【解决方案1】:

根据结果,“deviceIndex”似乎已注册但尚未启用。你可以试试看下面的代码能不能解决你的问题?

graph.tx().rollback()
mgmt.buildIndex('deviceIndex',Vertex.class).addKey(serialNumber,Mapping.STRING.asParameter()).addKey(manufacturer,Mapping.STRING.asParameter()).addKey(clas,Mapping.STRING.asParameter()).addKey(description,Mapping.TEXT.asParameter()).addKey(fw_version,Mapping.STRING.asParameter()).addKey(hw_version,Mapping.STRING.asParameter()).addKey(latitude).addKey(longitude).addKey(accuracy).addKey(measure_datetime).buildMixedIndex("search")
mgmt.commit()
graph.tx().commit()
ManagementSystem.awaitGraphIndexStatus(graph, 'deviceIndex').status(SchemaStatus.ENABLED).call()

有时,特别是在远程数据存储中(通过高延迟网络),立即启用索引需要一些时间,等待索引启用可能会对您的情况有所帮助。

【讨论】:

  • 谢谢!它的工作!你能告诉我为什么deviceIndex 可能不会自动启用吗?因为没有提到在 Titan s3.thinkaurelius.com/docs/titan/1.0.0/indexes.html 中启用索引
  • @freeza 索引如果没有问题会自动启用以避免它;但是,这可能需要一些时间。
猜你喜欢
  • 2016-11-12
  • 1970-01-01
  • 2016-09-08
  • 1970-01-01
  • 2016-06-20
  • 2016-04-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多