# Aggregate by multiple fields and Top 10 count in ElasticSearcch

**URL:** <https://discuss.elastic.co/t/aggregate-by-multiple-fields-and-top-10-count-in-elasticsearcch/259286>\
**Category:** Elasticsearch\
**Created:** [December 21, 2020, 4:33pm UTC](https://discuss.elastic.co/t/aggregate-by-multiple-fields-and-top-10-count-in-elasticsearcch/259286 "2020-12-21T16:33:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prabhu.292](https://avatars.discourse-cdn.com/v4/letter/p/c67d28/32.png) [@Prabhu.292](https://discuss.elastic.co/u/Prabhu.292)\
**Post date:** [December 21, 2020, 4:33pm UTC](https://discuss.elastic.co/t/aggregate-by-multiple-fields-and-top-10-count-in-elasticsearcch/259286/1 "2020-12-21T16:33:12Z")

</div>

Dear Team,

I have query like this

GET logstash-sdc-questionrecords/\_search?q=source:website\_portal  
{  
"aggs" : {  
"genres" : {  
"terms" : {  
"field" : "question.keyword",  
"order" : { "\_count" : "desc" },  
"size": 10  
},  
"aggs" : {  
"genres" : {  
"terms" : {  
"field" : "answer.keyword",  
"order" : { "\_count" : "desc" },  
"size": 10  
}  
}  
}  
}  
}  
}

When we execute the records for the few records only questions is coming and it is not showing up the answer against each question..  
In the database we have answers for all the questions.  
Please let me know the query to get the both questions and answers for 10 records

Below is the error.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/9/e926724427943cedbeb04c90762b721d697514ac.png)

---

<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:** [January 18, 2021, 4:33pm UTC](https://discuss.elastic.co/t/aggregate-by-multiple-fields-and-top-10-count-in-elasticsearcch/259286/2 "2021-01-18T16:33:19Z")

</div>

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