# 2.0 missing value for nested aggregations

**URL:** <https://discuss.elastic.co/t/2-0-missing-value-for-nested-aggregations/33385>\
**Category:** Elasticsearch\
**Created:** [October 30, 2015, 3:08pm UTC](https://discuss.elastic.co/t/2-0-missing-value-for-nested-aggregations/33385 "2015-10-30T15:08:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![javadevmtl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javadevmtl/32/45613_2.png) [@javadevmtl](https://discuss.elastic.co/u/javadevmtl)\
**Post date:** [October 30, 2015, 3:08pm UTC](https://discuss.elastic.co/t/2-0-missing-value-for-nested-aggregations/33385/1 "2015-10-30T15:08:52Z")

</div>

Hi, is missing value supported for nested aggs? The below example returns class cast exception, but single level on country it works fine. It will return the count of provinces for the missing country.

```
GET test/test/_search
{
  "size": 0, 
  "aggs": {
    "country": {
      "terms": {
        "field": "country",
        "size": 0,
        "missing": "NO_COUNTRY"
      },
      "aggs" :{
        "state" :{
          "terms": {
            "field": "province",
            "size": 0,
            "missing": "NO_PROVINCE"
          }
        }  
      }
    }
  }
}

```

Returns

```
{
   "error": {
      "root_cause": [
         {
            "type": "class_cast_exception",
            "reason": null
         },
         {
            "type": "class_cast_exception",
            "reason": null
         }
      ],
      "type": "search_phase_execution_exception",
      "reason": "all shards failed",
      "phase": "query",
      "grouped": true,
      "failed_shards": [
         {
            "shard": 0,
            "index": "test",
            "node": "aqU92h4pQima7KyVIQZqfQ",
            "reason": {
               "type": "class_cast_exception",
               "reason": null
            }
         },
         {
            "shard": 1,
            "index": "test",
            "node": "JEgLRrxuTYCF9tqq4pVw5w",
            "reason": {
               "type": "class_cast_exception",
               "reason": null
            }
         }
      ]
   },
   "status": 500
}
```

---

<div class="post-metadata">

**Author:** ![javadevmtl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javadevmtl/32/45613_2.png) [@javadevmtl](https://discuss.elastic.co/u/javadevmtl)\
**Post date:** [November 2, 2015, 2:30pm UTC](https://discuss.elastic.co/t/2-0-missing-value-for-nested-aggregations/33385/2 "2015-11-02T14:30:53Z")

</div>

Any thoughts on this?

---

<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:41pm UTC](https://discuss.elastic.co/t/2-0-missing-value-for-nested-aggregations/33385/3 "2017-07-05T23:41:15Z")

</div>


