Global Search

Is there a way where i can scan all the vertex or edge properties that match a given keyword in gremlin. For ex : g.V().has('name','John') where i'm explicitly giving filter as name, can someone help me with gremlin query to retrieve anything that matches 'John' ?
Solution:
you could do: ``` // 3.7.0+ gremlin> g.union(V(), E()).has('name','josh') ==>v[4]...
Jump to solution
1 Reply
Solution
spmallette
spmallette14mo ago
you could do:
// 3.7.0+
gremlin> g.union(V(), E()).has('name','josh')
==>v[4]

// before 3.7.0
gremlin> g.inject(0).union(V(), E()).has('name','josh')
==>v[4]
// 3.7.0+
gremlin> g.union(V(), E()).has('name','josh')
==>v[4]

// before 3.7.0
gremlin> g.inject(0).union(V(), E()).has('name','josh')
==>v[4]
This will probably not be an optimized query though (yet) for most graphs so you would want to take care in executing that. I think it would be preferred to execute this as two separate queries unless you have a graph that will optimize the union().
Want results from more Discord servers?
Add your server