# Using a missing aggregation for a Term, as opposed to a field

**URL:** <https://discuss.elastic.co/t/using-a-missing-aggregation-for-a-term-as-opposed-to-a-field/203118>\
**Category:** Elasticsearch\
**Created:** [October 10, 2019, 10:04pm UTC](https://discuss.elastic.co/t/using-a-missing-aggregation-for-a-term-as-opposed-to-a-field/203118 "2019-10-10T22:04:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ad\_rip](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@ad\_rip](https://discuss.elastic.co/u/ad_rip)\
**Post date:** [October 10, 2019, 10:04pm UTC](https://discuss.elastic.co/t/using-a-missing-aggregation-for-a-term-as-opposed-to-a-field/203118/1 "2019-10-10T22:04:34Z")

</div>

Hi all,

I'm hoping this is the right place to ask this. I'm trying to get an aggregation of the items that don't contain a specific field. They're items with a nested field, as follow:

```
                 "customFields": [
                     {
                         "key": "firstType",
                         "keywordValue": "1"
                     },
                     {
                         "key": "secondType",
                         "keywordValue": "A"
                     }
                 ]

```

I've been trying to use a missing aggregation, if I was trying to find all the items that don't contain a key with the value `firstType`, but haven't had much luck. The query I've made is:

```
 "aggregations": {
       "custom.firstType": {
               "missing": {
                 "field": "firstType"
               },
               "aggregations": {
                 "values": {
                   "reverse_nested": {}
                 }
               }
             }
           }

```

Unfortunately, this hasn't been much luck for me. What am I over looking?

Thanks!

---

<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:** [November 7, 2019, 10:04pm UTC](https://discuss.elastic.co/t/using-a-missing-aggregation-for-a-term-as-opposed-to-a-field/203118/2 "2019-11-07T22:04:35Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
