# Query/Filtering on Complex Document

**URL:** <https://discuss.elastic.co/t/query-filtering-on-complex-document/34463>\
**Category:** Elasticsearch\
**Created:** [November 12, 2015, 9:20pm UTC](https://discuss.elastic.co/t/query-filtering-on-complex-document/34463 "2015-11-12T21:20:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RigidLost](https://avatars.discourse-cdn.com/v4/letter/r/a88e57/32.png) [@RigidLost](https://discuss.elastic.co/u/RigidLost)\
**Post date:** [November 12, 2015, 9:20pm UTC](https://discuss.elastic.co/t/query-filtering-on-complex-document/34463/1 "2015-11-12T21:20:13Z")

</div>

I am newer to ElasticSearch so forgive me as I've exhausted my searches within the Reference Guide and elsewhere.

Here is an example of my current document:

```
{
     name: "",
     id: "",
     addresses: [{
         address_type: "",
         addr1: "",
         city: "",
         state: "",
         postal: ""
     }],
     jobs: [{
         jobtype: "",
         title: "",
         location: ""
     }]
 }

```

I need to query the entire document and return everything except for addresses where address\_type doesn't equal a specific value.

I know that exclude be leveraged, but not dynamically as is the case here.

Any help, insight, pseudo code for this type of query would be appreciated.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 11:38pm UTC](https://discuss.elastic.co/t/query-filtering-on-complex-document/34463/2 "2017-07-05T23:38:48Z")

</div>

Closed on July 5, 2017, 11:38pm UTC


