这不是个bug
因为创建索引时,有如下语句:
indexOnly(xxLabel)
所以,索引是与label绑定的!
Ah, you used indexOnly() to restrict the index by vertex label, so in order to utilize the index, your query must include the vertex label.
g.V().has("name-xuyou8","zhanghh")
提示:24198723 [gremlin-server-exec-2] WARN org.janusgraph.graphdb.transaction.StandardJanusGraphTx - Query requires iterating over all vertices [(name-xuyou8 = zhanghh)]. For better performance, use indexes
g.V().hasLabel("xuyou8").has("name-xuyou8","zhanghh")
索引被命中!