Gremlin query hints - Amazon Neptune
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

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 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 more information about the available query hints and their usage.