# Aggregations on unmapped fields

**URL:** <https://discuss.elastic.co/t/aggregations-on-unmapped-fields/21043>\
**Category:** Elasticsearch\
**Created:** [December 2, 2014, 9:23pm UTC](https://discuss.elastic.co/t/aggregations-on-unmapped-fields/21043 "2014-12-02T21:23:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SD1](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@SD1](https://discuss.elastic.co/u/SD1)\
**Post date:** [December 2, 2014, 9:23pm UTC](https://discuss.elastic.co/t/aggregations-on-unmapped-fields/21043/1 "2014-12-02T21:23:56Z")

</div>

Hi,

We are using Elasticsearch 1.3.2 and having issues running queries with  
aggregations on unmapped fields. Some documents in the index will have this  
nested aggregation field but some will not. Did some initial research but  
did not find a way to tell ES to ignore unmapped fields in aggregations.  
Looks like there is a setting to ignore unmapped fields for sort fields but  
not for aggregation fields.

This is the exception that am getting

```
  "status" : 500,
  "reason" : 

```

"RemoteTransportException[[serverXXXX][inet[/serverXXXX:9300]][search/phase/query]];  
nested: AggregationExecutionException[[nested] nested path [fieldName] not  
found]; "

According to this  
[https://github.com/elasticsearch/elasticsearch/issues/2569](https://github.com/elasticsearch/elasticsearch/issues/2569), aggregations  
should work fine on unmapped fields. Is that in a different version of ES?

Any input is appreciated.

Thanks,  
Shravanthi

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/976d9964-c6fe-4953-99da-bf470b887a0a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/976d9964-c6fe-4953-99da-bf470b887a0a%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [December 3, 2014, 12:31pm UTC](https://discuss.elastic.co/t/aggregations-on-unmapped-fields/21043/2 "2014-12-03T12:31:58Z")

</div>

Thanks for bringing this issue up, I opened

> <https://github.com/elastic/elasticsearch/issues/8760>
>
> When a field is unmapped, aggregations try to behave as if the field existed but… did not contain any value. The nested aggregation is an exception to this rule and fails if it is asked to run on a path that is not mapped, I think we should fix it to be consistent?
> 
> See https://groups.google.com/forum/?utm\_medium=email&utm\_source=footer#!msg/elasticsearch/f0VYoHs1SpU/dx\_iZW-U65kJ for more context.

On Tue, Dec 2, 2014 at 10:23 PM, SD [shravanthid1284@gmail.com](mailto:shravanthid1284@gmail.com) wrote:

> Hi,
> 
> We are using Elasticsearch 1.3.2 and having issues running queries with  
> aggregations on unmapped fields. Some documents in the index will have this  
> nested aggregation field but some will not. Did some initial research but  
> did not find a way to tell ES to ignore unmapped fields in aggregations.  
> Looks like there is a setting to ignore unmapped fields for sort fields but  
> not for aggregation fields.
> 
> This is the exception that am getting
> 
> ```
> "status" : 500,
> "reason" :
> 
> ```
> 
> "RemoteTransportException[[serverXXXX][inet[/serverXXXX:9300]][search/phase/query]];  
> nested: AggregationExecutionException[[nested] nested path [fieldName] not  
> found]; "
> 
> According to this  
> [https://github.com/elasticsearch/elasticsearch/issues/2569](https://github.com/elasticsearch/elasticsearch/issues/2569),  
> aggregations should work fine on unmapped fields. Is that in a different  
> version of ES?
> 
> Any input is appreciated.
> 
> Thanks,  
> Shravanthi
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/976d9964-c6fe-4953-99da-bf470b887a0a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/976d9964-c6fe-4953-99da-bf470b887a0a%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/976d9964-c6fe-4953-99da-bf470b887a0a%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/976d9964-c6fe-4953-99da-bf470b887a0a%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
Adrien Grand

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j7TAY1i6Z3pnh%2Ba4R582d8b5NfcRfwY14tWGt0VAco3NQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j7TAY1i6Z3pnh%2Ba4R582d8b5NfcRfwY14tWGt0VAco3NQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 12:46am UTC](https://discuss.elastic.co/t/aggregations-on-unmapped-fields/21043/3 "2017-07-06T00:46:17Z")

</div>


