# Median aggregation and routing

**URL:** https://discuss.elastic.co/t/median-aggregation-and-routing/257276
**Category:** Elasticsearch
**Created:** [December 1, 2020, 9:01pm UTC](https://discuss.elastic.co/t/median-aggregation-and-routing/257276 "2020-12-01T21:01:05Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![pcb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pcb/32/48423_2.png) [@pcb](https://discuss.elastic.co/u/pcb)
#### Post date: [December 1, 2020, 9:01pm UTC](https://discuss.elastic.co/t/median-aggregation-and-routing/257276/1 "2020-12-01T21:01:06Z")

</div>

Hi ya, I'm working on spec'ing out a new datastore for aggregate calculations for near-real time dashboards and I'm evaluating Elasticsearch.

I've read here that median is usually approximated: [https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-percentile-aggregation.html#search-aggregations-metrics-percentile-aggregation-approximation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-percentile-aggregation.html#search-aggregations-metrics-percentile-aggregation-approximation)

In my dataset, I'm using routing and was wondering if there was a way to make the median more accurate in Elasticsearch, especially given that the number of documents will be in the thousands and all on the same node (for large orgs, the number of documents may reach a few hundred thousand at most but that is very rare). The high relative error in median is a bit worrying.

(Note: If anyone has any suggestions for an alternative aggregation datastore I'd take that too! 😃 )  
Thanks!  
Patrick

---

<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: [December 29, 2020, 9:01pm UTC](https://discuss.elastic.co/t/median-aggregation-and-routing/257276/2 "2020-12-29T21:01:13Z")

</div>

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