Search code examples
javagremlingremlin-server

Why is gremlin-server not returning an edge by it's ID?


I'm using gremlin-server 3.4.11 and connecting to it with java tinkerpop gremlin-driver.

g.E() returns all the edges:

[
  {
    "id": 18,
    "label": "RELATED",
    "type": "edge",
    "inVLabel": "GREMLIN2",
    "outVLabel": "GREMLIN1",
    "inV": 16,
    "outV": 14
  }
]

but g.E(18) OR g.E().hasId(18) returns empty list:

[]

Why is that? I would assume, that the corresponding edge would be returned, but it is not. What am I missing here?

Note: I tried to create an edge with g.V(14).addE('RELATED').property('id', 'someId').to(g.V(16)).. this is then found with g.E().has('id', 'someId'), BUT it is not the ID of the edge, merely property named 'id'. hasId() step also returns empty list.

Any hints would be greatly appreciated!


Solution

  • Are you using TinkerGraph? Is yes, the IDs are stored as long internally.

    Please try g.E(18L)