# Calculation possible?

**URL:** <https://discuss.elastic.co/t/calculation-possible/132045>\
**Category:** Elasticsearch\
**Created:** [May 16, 2018, 7:00am UTC](https://discuss.elastic.co/t/calculation-possible/132045 "2018-05-16T07:00:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![remco\_zwaan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/remco_zwaan/32/129991_2.png) [@remco\_zwaan](https://discuss.elastic.co/u/remco_zwaan)\
**Post date:** [May 16, 2018, 7:00am UTC](https://discuss.elastic.co/t/calculation-possible/132045/1 "2018-05-16T07:00:29Z")

</div>

Hi,

This is part of a result of room X.

"prices": {  
"2019-05-15": 80,  
"2019-05-16": 80,  
"2019-05-17": 85,  
"2019-05-18": 88,  
},

Each day can have a different price per room. Based on visitor client side calendar input (1,2,3 ect days selected) we want to calculate the total price and show in the listing results. We calculate now on client / runtime (ruby/rails). We have more then 1200 rooms in our inventory so calculation on runtime (ruby) is slow (+ 4 secs) and cost a lot memory.

Is there a way to calculate in ES? or other solution?

Ciao..remco

---

<div class="post-metadata">

**Author:** ![mjunaidmuzammil](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mjunaidmuzammil/32/56910_2.png) [@mjunaidmuzammil](https://discuss.elastic.co/u/mjunaidmuzammil)\
**Post date:** [May 16, 2018, 11:33am UTC](https://discuss.elastic.co/t/calculation-possible/132045/2 "2018-05-16T11:33:52Z")

</div>

Hi,

Didn't get your question? You can user metrics aggregation to get statistics from your documents indexed in ES. ([https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics.html)). I am unsure whether you were looking for something similar.

---

<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:** [June 13, 2018, 11:34am UTC](https://discuss.elastic.co/t/calculation-possible/132045/3 "2018-06-13T11:34:01Z")

</div>

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