# Aggregation sorting performance implications

**URL:** https://discuss.elastic.co/t/aggregation-sorting-performance-implications/90469
**Category:** Elasticsearch
**Created:** [June 22, 2017, 1:57pm UTC](https://discuss.elastic.co/t/aggregation-sorting-performance-implications/90469 "2017-06-22T13:57:30Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![blaineparker](https://avatars.discourse-cdn.com/v4/letter/b/8dc957/32.png) [@blaineparker](https://discuss.elastic.co/u/blaineparker)
#### Post date: [June 22, 2017, 1:57pm UTC](https://discuss.elastic.co/t/aggregation-sorting-performance-implications/90469/1 "2017-06-22T13:57:30Z")

</div>

Hi There.

I have a parent child aggregation which counts child documents over a parent field where parents meet a certain criteria and children meet another criteria. I want these results sorted by matching children count.

I wanted to know what the performance implication would be of using this kind of sorting vs using default sorting.

Query structure is as follows:

parentFilter{  
parentTerms{  
terms {parent field}  
childrenCount {  
childrenFilter{}  
}  
}  
}

And I order by "order" : {childrenCount\>childrenFilter}

---

<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 20, 2017, 1:57pm UTC](https://discuss.elastic.co/t/aggregation-sorting-performance-implications/90469/2 "2017-07-20T13:57:59Z")

</div>

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