# Attempted nested aggregations claiming that document isn't nested

**URL:** <https://discuss.elastic.co/t/attempted-nested-aggregations-claiming-that-document-isnt-nested/42534>\
**Category:** Elasticsearch\
**Created:** [February 23, 2016, 11:25pm UTC](https://discuss.elastic.co/t/attempted-nested-aggregations-claiming-that-document-isnt-nested/42534 "2016-02-23T23:25:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anisbet](https://avatars.discourse-cdn.com/v4/letter/a/eb8c5e/32.png) [@anisbet](https://discuss.elastic.co/u/anisbet)\
**Post date:** [February 23, 2016, 11:25pm UTC](https://discuss.elastic.co/t/attempted-nested-aggregations-claiming-that-document-isnt-nested/42534/1 "2016-02-23T23:25:45Z")

</div>

Hi, I am having an issue with a nested document query, that hopefully someone can help me with. I have verified that the mapping indicates that target object is described as a nested object. my aggregation in the query looks like this(full query is pretty big, so I am not including it for now)

{"resolutions": {  
"terms": {  
"field": "publish\_actions.status"  
},  
"aggs": {  
"publish\_actions": {  
"nested": {  
"path": "publish\_actions"  
},  
"aggs": {  
"current\_status": {  
"top\_hits": {  
"sort": [  
{  
"publish\_actions.published\_at": {  
"order": "desc"  
}  
}  
],  
"size": 1  
}  
}}}  
}}}

the yields the following response:

{  
"error": {  
"root\_cause": [  
{  
"type": "aggregation\_execution\_exception",  
"reason": "[nested] nested path [publish\_actions] is not nested"  
}  
],  
"type": "search\_phase\_execution\_exception",  
"reason": "all shards failed",  
"phase": "query",  
"grouped": true,  
"failed\_shards": [  
{  
"shard": 0,  
"index": "new\_es\_perf\_test\_20160222",  
"node": "PUpvsGOuTai5HeP9SUX0eA",  
"reason": {  
"type": "aggregation\_execution\_exception",  
"reason": "[nested] nested path [publish\_actions] is not nested"  
}  
}  
]  
},  
"status": 500  
}

somewhat lost, at this point, any guidance would be greatly appreciated.

Thank you.

---

<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:14pm UTC](https://discuss.elastic.co/t/attempted-nested-aggregations-claiming-that-document-isnt-nested/42534/2 "2017-07-05T23:14:04Z")

</div>


