Hi Vinayak,
If you would bother to demonstrate this behavior with a reproducible, generated graph, you can report it as an issue on github.
For now, you can only look for workarounds:
- combine the four clauses outside of gremlin
- try g.V()......................fold().V()......................fold().V().......................fold().V()......................... instead of the union, although I am not sure janusgraph will use the index for the repeated V() steps. The fold() steps ensure that the V() steps are run exactly once.
Best wishes, Marc