我使用 Titan 1.0 和 elasticsearch 作为后端。从 Titan 文档中,我了解到使用 elasticsearch 时,我们在构建索引时使用了混合索引。这是我的用例和问题:我正在为书店的注册数据、我有注册时间的数据以及姓名和年龄等其他个人信息创建一个图形数据库。我想查询在给定时间范围内注册的所有用户,换句话说,我想要一个用于查询的数字比较函数。这就是我创建索引的方式:
PropertyKey propertyKey = mgmt.makePropertyKey("registTime").dataType(Date.class)
.cardinality(Cardinality.SINGLE).make()
timeIndex = mgmt.buildIndex("registeredTime",Vertex.class)
.addKey("registTime", Mapping.TEXTSTRING.asParameter())
.buildMixedIndex("search");
timeIndex 已成功创建,但是,当我想查询注册时间时:
g.V().has("registTime", gt("2015-01-01 00:00:00.000+0000"))
它给了我:
WARN com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx - Query requires iterating over all vertices [()]. For better performance, use indexes
它给了我一个空的结果,尽管我用 gremlin 命令检查并确认数据就在那里。我做错什么了吗?我怎么解决这个问题?