Amazon Neptune
User Guide (API Version 2017-11-29)

Gremlin Query Hints

You can use query hints to specify optimization and evaluation strategies for a particular Gremlin query in Amazon Neptune.

Query hints are specified by adding a withSideEffect step to the query with the following syntax.

g.withSideEffect(hint, value)
  • hint – Identifies the type of the hint to apply.

  • value – Determines the behavior of the system aspect under consideration.

For example, the following shows a how to include a repeatMode hint in a Gremlin traversal.


All Gremlin query hints side effects are prefixed with Neptune#.

g.withSideEffect('Neptune#repeatMode', 'DFS').V("3").repeat(out()).times(10).limit(1).path()

The preceding query instructs the Neptune engine to traverse the graph Depth First (DFS) rather than the default Neptune, Breadth First (BFS).

The following sections provide further information about the available query hints and their usage.