# Expand not allowed multiple times in same sub-query

**URL:** <https://discuss.dgraph.io/t/expand-not-allowed-multiple-times-in-same-sub-query/18122>\
**Category:** Dgraph\
**Created:** [December 21, 2022, 12:11pm UTC](https://discuss.dgraph.io/t/expand-not-allowed-multiple-times-in-same-sub-query/18122 "2022-12-21T12:11:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![droslean](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/droslean/32/9583_2.png) [@droslean](https://discuss.dgraph.io/u/droslean)\
**Post date:** [December 21, 2022, 12:11pm UTC](https://discuss.dgraph.io/t/expand-not-allowed-multiple-times-in-same-sub-query/18122/1 "2022-12-21T12:11:44Z")

</div>

Version: `v21.12.0`

Let’s say that we have this schema:

```auto
type Job {
	id: ID! 
	description: String 
	title: String 
}

type Person {
	name: String! 
	address: String 
	job: Job 
	id: ID 
}

```

If we try to get a Person using DQL, and use `expand(_all_)`, the result won’t include the `job` field since it’s another type.

How can I tell DQL to expand all non-type fields and selectively expand my typed fields?

example:

```auto
query(func: type(Person)) {
  uid
  expand(_all_)
  expand(Job) {
     uid
  }
}

```

---

<div class="post-metadata">

**Author:** ![vnium](https://avatars.discourse-cdn.com/v4/letter/v/e56c9b/32.png) [@vnium](https://discuss.dgraph.io/u/vnium)\
**Post date:** [December 21, 2022, 1:22pm UTC](https://discuss.dgraph.io/t/expand-not-allowed-multiple-times-in-same-sub-query/18122/2 "2022-12-21T13:22:58Z")

</div>

The closest you can get is to either use `expand(_all_){uid}` to get all predicates and all edges with the UID included. Or `expand(_all_)@filter(type(type1) OR type(type2)){uid}` to get only the edges of specific types, but this filters out value predicates.

Read more here: [https://dgraph.io/docs/query-language/expand-predicates/#filtering-during-expand](https://dgraph.io/docs/query-language/expand-predicates/#filtering-during-expand)

---

<div class="post-metadata">

**Author:** ![droslean](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/droslean/32/9583_2.png) [@droslean](https://discuss.dgraph.io/u/droslean)\
**Post date:** [December 21, 2022, 10:43pm UTC](https://discuss.dgraph.io/t/expand-not-allowed-multiple-times-in-same-sub-query/18122/3 "2022-12-21T22:43:28Z")

</div>

Yea, but I also need to expand the non-typed fields. The error in question doesn’t make any sense since the first `expand(_all_)` won’t expand any of the typed fields. It makes sense to use another expand with filters for it.
