# Specifying bucket values ordering in Range aggregation

**URL:** <https://discuss.elastic.co/t/specifying-bucket-values-ordering-in-range-aggregation/19697>\
**Category:** Elasticsearch\
**Created:** [September 10, 2014, 12:13am UTC](https://discuss.elastic.co/t/specifying-bucket-values-ordering-in-range-aggregation/19697 "2014-09-10T00:13:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raul\_Jr\_Martinez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/raul_jr_martinez/32/1286_2.png) [@Raul\_Jr\_Martinez](https://discuss.elastic.co/u/Raul_Jr_Martinez)\
**Post date:** [September 10, 2014, 12:13am UTC](https://discuss.elastic.co/t/specifying-bucket-values-ordering-in-range-aggregation/19697/1 "2014-09-10T00:13:49Z")

</div>

Hello,

I'd like to add an "order" parameter to a range aggregation ( use case:  
sorting the age of records from latest added to oldest) but adding "order"  
: {"\_terms":"asc"} or \_count causes a search error.

I'm trying to confirm if "range" aggregation doesn't really support "order"  
parameter at this point or am I just missing anything. Been into the  
documentation examples, mailing list and github issues but couldn't really  
confirm if this is really the case.

Thanks  
Raul

--  
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/a0b4c6a2-69b0-4e70-96ed-f1497cd80f27%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a0b4c6a2-69b0-4e70-96ed-f1497cd80f27%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:** [September 10, 2014, 8:55pm UTC](https://discuss.elastic.co/t/specifying-bucket-values-ordering-in-range-aggregation/19697/2 "2014-09-10T20:55:07Z")

</div>

The range aggregation indeed does not support ordering. I believe that is  
something that would be easy to implement on client side?

On Wed, Sep 10, 2014 at 2:13 AM, Raul, Jr. Martinez [juneym@gmail.com](mailto:juneym@gmail.com)  
wrote:

> Hello,
> 
> I'd like to add an "order" parameter to a range aggregation ( use case:  
> sorting the age of records from latest added to oldest) but adding "order"  
> : {"\_terms":"asc"} or \_count causes a search error.
> 
> I'm trying to confirm if "range" aggregation doesn't really support  
> "order" parameter at this point or am I just missing anything. Been into  
> the documentation examples, mailing list and github issues but couldn't  
> really confirm if this is really the case.
> 
> Thanks  
> Raul
> 
> --  
> 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/a0b4c6a2-69b0-4e70-96ed-f1497cd80f27%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a0b4c6a2-69b0-4e70-96ed-f1497cd80f27%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/a0b4c6a2-69b0-4e70-96ed-f1497cd80f27%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/a0b4c6a2-69b0-4e70-96ed-f1497cd80f27%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/CAL6Z4j63wsQM%2B9tvbmku9fw8JaPdAvgvBduTrHmAG3TE54mY3w%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j63wsQM%2B9tvbmku9fw8JaPdAvgvBduTrHmAG3TE54mY3w%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Sven\_Jorns](https://avatars.discourse-cdn.com/v4/letter/s/ecd19e/32.png) [@Sven\_Jorns](https://discuss.elastic.co/u/Sven_Jorns)\
**Post date:** [October 9, 2014, 1:15pm UTC](https://discuss.elastic.co/t/specifying-bucket-values-ordering-in-range-aggregation/19697/3 "2014-10-09T13:15:26Z")

</div>

But if I'm limiting the results by size(), I need to order to have specific  
results like the 10 bests order or is there another way?

Am Mittwoch, 10. September 2014 22:55:33 UTC+2 schrieb Adrien Grand:

> The range aggregation indeed does not support ordering. I believe that is  
> something that would be easy to implement on client side?

--  
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/2bd40662-8c7f-42f4-a713-3a4e240cda3f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/2bd40662-8c7f-42f4-a713-3a4e240cda3f%40googlegroups.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:57am UTC](https://discuss.elastic.co/t/specifying-bucket-values-ordering-in-range-aggregation/19697/4 "2017-07-06T00:57:18Z")

</div>


