Reputation: 1
I want to count how many vertices (nodes) are in the graph:
gremlin>g.V().count().next()
Could not find a suitable index to answer graph query and graph scans are disabled: [(~label = user)]:VERTEX
Gremlin.version() is 3.2.9
I use janusGraph hbase to store data, es to store index.
But some query is ok like this:
gremlin> g.V().has('user_id','47357061').values('real_name')
==>jack
I don't understand why I can't query the count.
Upvotes: 0
Views: 547
Reputation: 2809
JanusGraph simply cannot answer that traversal without iterating over all vertices. It doesn't store the count as a separate value in the backend so it actually has to compute the count for this traversal which means iterating over all vertices.
The warning you see just informs you about this fact and advises you to only execute traversals that can be executed by using an index as all other traversals will run into scalability issues if your graph grows.
If you really need the functionality to execute traversals that cannot make use of an index as they have to traverse over all vertices in your graph (or a large number of vertices), then you should look into Hadoop-Gremlin which uses Spark to execute such a traversal in parallel with multiple Spark workers.
Upvotes: 1