Skip to main content
Version: 2.4.7

ancestors Command

The ancestors command selects all ancestors of nodes returned in a query.

Please refer to the Search Traversals for a detailed explanation of traversals.

Usage‚Äč

ancestors [--with-origin] <edge_type>

Options‚Äč

OptionDescription
--with-originIncludes the current element in the result set.

Parameters‚Äč

ParameterDescriptionRequired?Default Value
edge_typeEdge type by which to traverse‚ĚĆdelete

Examples‚Äč

Equivalent to 'search is(aws_region) <-[1:]-'
> search is(aws_region) | ancestors
Equivalent to 'search is(aws_region) <-[0:]-'
> search is(aws_region) | ancestors --with-origin
> search is(volume_type) limit 1 | ancestors
‚Äčkind=gcp_service_sku, id=D2, name=Storage PD Capacity, age=5d8h, cloud=gcp, account=sre
‚Äčkind=gcp_zone, id=2, name=us-central1-a, age=52yr1mo, cloud=gcp, account=sre, region=us-central1, zone=us-central1-a
‚Äčkind=gcp_region, id=1000, name=us-central1, age=52yr1mo, cloud=gcp, account=sre, region=us-central1
‚Äčkind=gcp_service, id=6F81-5844-456A, name=Compute Engine, age=5d8h, cloud=gcp, account=sre
‚Äčkind=gcp_project, id=sre-tests, name=sre-tests, age=5d8h, cloud=gcp, account=sre
‚Äčkind=cloud, id=gcp, name=gcp, age=5d8h, cloud=gcp
‚Äčkind=graph_root, id=root, name=root