# Elasticsearch give a factor to aggregations

**URL:** <https://discuss.elastic.co/t/elasticsearch-give-a-factor-to-aggregations/20244>\
**Category:** Elasticsearch\
**Created:** [October 14, 2014, 4:08pm UTC](https://discuss.elastic.co/t/elasticsearch-give-a-factor-to-aggregations/20244 "2014-10-14T16:08:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Remi\_Nonnon](https://avatars.discourse-cdn.com/v4/letter/r/f19dbf/32.png) [@Remi\_Nonnon](https://discuss.elastic.co/u/Remi_Nonnon)\
**Post date:** [October 14, 2014, 4:08pm UTC](https://discuss.elastic.co/t/elasticsearch-give-a-factor-to-aggregations/20244/1 "2014-10-14T16:08:06Z")

</div>

Hi all,

I'm wondering something about aggregations, say "Percentiles".  
When a percentile aggregation is processed, it uses a specific field as a  
reference. If the 50th percentile for field 'f' is 10, it means there are  
50% of documents with 'f' under 10.  
=\> Each document has the same weight in the aggregation (=1)

I'm wondering if it could be possible to give a different weight for each  
document.  
The following Gist give an example of what I'd like to do :

> <https://gist.github.com/rnonnon/093c111014bd14a46efe>

I'd like to compute some percentiles on the "age" field. But for each  
document, there is a "count" field associated.  
For example, there are 5 person who are 10 years old ; 1 who is 20 years  
old...  
If the percentile agg runs, it won't use my factor to compute the  
percentile...  
I don't think that feature is natively supported, but, do you guess it  
could be easily supported?

Thanks.

--  
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/17f66762-e51c-4241-9957-e34403e4f054%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/17f66762-e51c-4241-9957-e34403e4f054%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:56am UTC](https://discuss.elastic.co/t/elasticsearch-give-a-factor-to-aggregations/20244/2 "2017-07-06T00:56:18Z")

</div>


