#### Re: The use of vertex-centric index

Leah <18834...@...>

Hi Marc，
After testing, has() step() condition is necessary, this solution is very effective.Thank you for all your assistance.

Warm regards,
Leah

I am not sure the has() step is even necessary, or maybe just has('amount') is sufficient to trigger the - already sorted - index.

Best wishes,

Marc

Op zondag 26 juli 2020 om 11:15:16 UTC+2 schreef 18...@...:

How can I use the index to get the top 500 edges of the amount descending sort faster?

You already specified the vertex-centrex index on the amount key to be ordered while creating the index. By explicitly reordering the results in the traversal, the index cannot take effect because the reordering needs alls vertices to be retrieved instead of just the first 500.

HTH,    Marc

Op zaterdag 25 juli 2020 om 20:52:37 UTC+2 schreef 18...@...:

Hi JanusGraph team,

I have created a vertex-centric indexes for vertices. As follows, now I want to use the index to get the information of the top 500 edges in descending sort. However, I find that the execution time is the same as that without vertex index. How can I use the index to sort faster and extract the information of the first 500 edges more quickly?

Here's the graph I've built：

Here's the data I inserted, building a starting point, a million edges associated with it, and 100 endpoints,

graph_conf = 'janusgraph-cql-es-server-test2.properties'
graph = JanusGraphFactory.open(graph_conf)
g = graph.traversal()
int start_value = 1
int end_value = 1000000

cloumns = line.split(',', -1)
amount = amount.toBigDecimal()
tx_index = log_index.toInteger()
for (int i = start_value; i <= end_value; i++) {
Date ts = new Date((timestamp.toLong() - i) * 1000)
.property('amount', amount + i)
.property('tx_hash', tx_hash)
.property('tx_index', tx_index + i)
.property('created_time', ts)
.next()

if (i % 20000 == 0) {
println("[total:\${i}]")
System.sleep(500)
g.tx().commit()
graph.close()
System.sleep(5000)

graph = JanusGraphFactory.open(graph_conf)
g = graph.traversal()
System.sleep(5000)
}
g.tx().commit()
}

graph.close()

Here are my query criteria: