# Elastic Query

**URL:** <https://discuss.elastic.co/t/elastic-query/244572>\
**Category:** Elasticsearch\
**Created:** [August 11, 2020, 2:39pm UTC](https://discuss.elastic.co/t/elastic-query/244572 "2020-08-11T14:39:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![thejaswani](https://avatars.discourse-cdn.com/v4/letter/t/e9c0ed/32.png) [@thejaswani](https://discuss.elastic.co/u/thejaswani)\
**Post date:** [August 11, 2020, 2:39pm UTC](https://discuss.elastic.co/t/elastic-query/244572/1 "2020-08-11T14:39:39Z")

</div>

we are using elastic 5.6.2. In this version, how we do the term aggregation for nested objetcs with limit and offset? Please advice..

We have tried this query  
{  
"index": "sample\_mastercollection",  
"type": "collectionsform",  
"body": {  
"size": 0,  
"query": {  
"bool": {  
"must": [  
{  
"match": {  
"masterid": "2\_266247426322"  
}  
},  
{  
"match": {  
"visibility": "yes"  
}  
},  
{  
"nested": {  
"path": "collectedform",  
"query": [  
{  
"bool": {  
"must": [  
{  
"match\_phrase": {  
"collectedform.masterid": "7357841"  
}  
}  
]  
}  
}  
]  
}  
}  
]  
}  
},  
"aggs": {  
"formfilter": {  
"nested": {  
"path": "collectedform"  
},  
"aggs": {  
"filter\_types": {  
"filter": {  
"bool": {  
"must": [  
{  
"match": {  
"collectedform.masterid": "7357841"  
}  
}  
],  
"must\_not": [  
{  
"match": {  
"collectedform.value.value.raw": ""  
}  
}  
]  
}  
},  
"aggs": {  
"\_filter": {  
"terms": {  
"size": 100,  
"field": "collectedform.value.value.raw"  
}  
}  
}  
}  
}  
}  
}  
}  
}

---

<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:** [September 8, 2020, 2:39pm UTC](https://discuss.elastic.co/t/elastic-query/244572/2 "2020-09-08T14:39:43Z")

</div>

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