【发布时间】:2015-03-18 13:06:12
【问题描述】:
在我们的大型 Titan Graph 数据库中,我注意到以下行为:
\,,,/
(o o)
-----oOOo-(_)-oOOo-----
14:16:35 WARN org.apache.hadoop.util.NativeCodeLoader - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
gremlin> g = TitanFactory.open('/home/willem/workspace/ovc/src/main/resources/titan-cassandra-es.properties')
14:16:44 WARN com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration - Local setting cache.db-cache-time=0 (Type: GLOBAL_OFFLINE) is overridden by globally managed value (180000). Use the ManagementSystem interface instead of the local configuration to control this setting.
==>titangraph[com.thinkaurelius.titan.diskstorage.cassandra.astyanax.AstyanaxStoreManager:[10.1.0.200]]
gremlin> g.indexQuery("mediaSerialNBStringIdx","v.mediaSerialNB:EB*").vertices().count()
==>937
gremlin> g.V().has("mediaSerialNB",PREFIX,"EB").count()
14:17:17 WARN com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx - Query requires iterating over all vertices [(mediaSerialNB PREFIX EB)]. For better performance, use indexes
因此,使用 indexQuery(...) 直接寻址索引会利用索引,但将其留给查询优化器,它不会了解该特定字段上存在 MixedIndex 的事实。
这是与 elasticsearch 1.2.2 一起运行的 Titan 0.5.3。
这些是索引细节:
gremlin> m = g.getManagementSystem()
==>com.thinkaurelius.titan.graphdb.database.management.ManagementSystem@6a26cb53
gremlin> m.getGraphIndex("mediaSerialNBStringIdx").isMixedIndex()
==>true
gremlin> m.getGraphIndex("mediaSerialNBStringIdx").getFieldKeys()
==>mediaSerialNB
gremlin> m.getGraphIndex("mediaSerialNBStringIdx").getBackingIndex()
==>search
gremlin> k = m.getPropertyKey("mediaSerialNB")
==>mediaSerialNB
gremlin> m.getGraphIndex("mediaSerialNBStringIdx").getIndexStatus(k)
==>INSTALLED
索引状态是“INSTALLED”而不是“ENABLED”这一事实是否给了我线索?如果是这样,我该如何帮助 elasticsearch 启用它?
阅读重新索引,我发现以下内容:
mgmt.updateIndex(rindex, SchemaAction.ENABLE_INDEX);
但这是我们的数据库告诉我们的:
gremlin> mediaSerialNBKey = g.getPropertyKey("mediaSerialNB")
==>mediaSerialNB
gremlin> mediaSerialNBStringIdx = m.getGraphIndex("mediaSerialNBStringIdx")
==>com.thinkaurelius.titan.graphdb.database.management.TitanGraphIndexWrapper@7c54dcff
gremlin> mediaSerialNBStringIdx.getParametersFor(mediaSerialNBKey)
==>mapping->STRING
==>mapped-name->4h6t
==>status->INSTALLED
gremlin> m.updateIndex(mediaSerialNBStringIdx, SchemaAction.ENABLE_INDEX)
Update action [ENABLE_INDEX] does not apply to any fields for index [com.thinkaurelius.titan.graphdb.database.management.TitanGraphIndexWrapper@7c54dcff]
【问题讨论】:
标签: indexing elasticsearch titan gremlin