Retrieve all edges with all ranks using FETCH query

Using query:
FETCH PROP ON edgeName “sourceId” → “destinationId”;

This query only retrieves only the edge with rank 0. How do we fetch edges with all ranks between 2 given vertexIds?


If the previous src_id and dst_id are known, we could use GO instead to get all edges(with all ranks), fetch now needs to explicitly provide rank.

If this is(getting edge) the start of the query, we will need to create index on edge to enable this with lookup.

CREATE EDGE INDEX e1_index on e1()
rebuild edge index e1_index
(root@nebula) [basketballplayer]> lookup on e1 yield edge as e
| e                      |
| [:e1 "10"->"11" @0 {}] |
| [:e1 "10"->"11" @1 {}] |
| [:e1 "10"->"11" @2 {}] |
INSERT EDGE e1 () VALUES "10"->"11":();
INSERT EDGE e1 () VALUES "10"->"11"@1:();
INSERT EDGE e1 () VALUES "10"->"11"@2:();

Cheers, wey

Hi @wey , thanks for the reply. Yes, I understood this part.
I use GO FROM “src_vid” over sellocPincodeLPTat where dst(edge)==“dest_vid” yield properties(edge); to get all the edges. But this query takes 1133272/1136350 us (approx 1.3 seconds).

However, the fetch query FETCH PROP ON edgeName “src_vid” ->“dest_vid”@0; takes just 5631/7194 us (approx 0.005 seconds).

Can we provide support for a query like FETCH PROP ON edgeName “src_vid” ->“dest_vid” @[*]? Where [*] after the dest_vid fetches all the edges from rank 0-n between the given src_vid and dest_vid, as we see that FETCH is comparatively very fast?

Thanks, Vishal

Hi @wey, I’m using a composite query involving GO and FETCH.
GO FROM “v1_id” over edgeName1 yield $$ as alliasId | FETCH PROP ON edgeName2 $-.alliasId → “v3_vid” YIELD properties(edge);

Required Traversal: v1 → v2 → v3

I need to traverse from a known v1_vid to a known v3_vid. The output of v2_vid should be used as an input to the FETCH query (as the number of edges of type edgeName2 is around 2 Billion and FETCH performs faster).
With the above query, I get a syntax error at `’ YIELD '. Looks like the problem is while providing the v3_vid in the query, which can’t be harcoded/provided. But since the v3_vid needs to be provided by us, this query is not working.

Is there a workaround to provide the v3_vid by the user? Or is it mandatory for v3_vid to be an output of the GO query.

Dear @chvr203

could you try use GO instead of FETCH after the pipe?

GO FROM "player100" OVER follow yield $$, id($$) as alliasId | \
GO from $-.alliasId OVER follow WHERE id($$) == "player102" YIELD properties(edge)

FETCH doesn’t support this pattern yet, if the performance cannot fulfill your requirement, please help raise an issue for adding support of FETCH after pipe :slight_smile: