Skip to main content

ancestors Command

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

Usage

ancestors [--with-origin] <edge_type>

Parameters

ParameterDescriptionRequired?Default Value
edge_typeEdge type by which to traversedelete

Options

OptionDescriptionRequired?
--with-originInclude current element in the result set

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

Further Reading