g.with( '<option>',[<option_value> ] )


  • allow-filtering: A mirror function of ALLOW FILTERING in Cassandra. While useful for development, not recommended for production because of performance degradation. By default, ALLOW FILTERING is disabled.

  • batch: By default, graph traversals do not use batches. This option can enabled logged batching, and all data-modifying CQL statements associated with the graph query will be executed as a single logged batch.

  • consistency: Set the consistency level for read or write actions. Possible values are: ANY, ONE, TWO, THREE, QUORUM, ALL, LOCAL_QUORUM, EACH_QUORUM, and LOCAL_ONE.

  • force-vertex-deletion: By default, graph throws an exception when all edges cannot be found for a vertex being deleted. This option can override the exception and perform deletion to the extent supported by the schema. When force-vertex-deletion is true, the vertex will be deleted, and so will any incident edges covered by a usable index or for which the edge table is keyed by the deleted vertex ID. Any other incident edges — those for which a scan would be required — will not be deleted. This option can potentially leave edge table rows pointing to a vertex that no longer exists.

  • ignore-unindexed: Return partial results while ignoring data without an index.

  • label-warning: Execute a traversal without the missing label warning. Useful for query exploration.

  • max-mutations: Traversals that change the data, like traversals containing addV(), can eventually lead up to too many underlying mutating queries. This option can change the default limit of underlying CQL queries is 10,000 mutations. To completely disable the limits check, set the limit to any number that’s <= 0.

  • read-before-write: Some traversals require a read-before-write action. By default, a warning is issued for such queries. This option can be set to ignore the warning, or reset to warn.


Find a person with a particular name without requiring an index:

g.with('allow-filtering').V().has('person', 'name', 'Julia CHILD')

g.with('allow-filtering').V().has('person', 'name', 'Julia CHILD')

Add two vertices using a batched statement:

    property('person_id', '802207f2-4e0b-4c6a-8328-5c9c21477df6' as UUID).
    property('name', 'Alice JONES').
    property('person_id', 'c712c2ef-1281-4854-98ce-2f68a3d67305' as UUID).
    property('name', 'Bob SMITH')

Set the consistency level for a read:

g.with('consistency', QUORUM).
  V().has('gender', 'F').out()

or a write:

g.with('consistency', LOCAL_QUORUM).
  property('person_id', '807e2664-7239-466f-bf59-632dcbcb4f57' as UUID) 

Forcing the deletion of a vertex and all its edges that can be deleted:

  V().has('name', 'Sharon SMITH').

Run the query and ignore unindexed data:

g.with('ignore-unindexed', true).V()

Execute the query and ignore the warning that labels are not present in the query:

g.with("label-warning", false).V()

Execute the addV traversal with a maximum of 10 mutations:

g.with('max-mutations', 10).
    property('ingred_id', 3050).
    property('name', 'turnip')

Execute the query and ignore the read-before-write warning:

g.with('read-before-write', 'ignore').
    has('name', 'John DOE').
    property('gender', 'M')

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000, info@datastax.com