# Operations on "doc\_count"

**URL:** <https://discuss.elastic.co/t/operations-on-doc-count/61969>\
**Category:** Elasticsearch\
**Created:** [September 30, 2016, 10:19pm UTC](https://discuss.elastic.co/t/operations-on-doc-count/61969 "2016-09-30T22:19:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ave19](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ave19/32/11631_2.png) [@ave19](https://discuss.elastic.co/u/ave19)\
**Post date:** [September 30, 2016, 10:19pm UTC](https://discuss.elastic.co/t/operations-on-doc-count/61969/1 "2016-09-30T22:19:56Z")

</div>

I have an issue that is not unlike this request...

[Apply a simple math operation to doc\_count](https://discuss.elastic.co/t/apply-a-simple-math-operation-to-count-result/23817)

We have events rolling in, we look at them and check for certain features. We mark them with a sort of classification scheme. Say "Apples" and "Bananas".

I can "aggs" on that scheme and get a doc\_count for Apples and Bananas.

Is there a way to get the Apple to Banana ratio?

I see this is open: [doc\_count metric agg](https://github.com/elastic/elasticsearch/issues/17631)

I had the thought of logstash -\> mutate -\> add\_field something like `{ "__count_me": 1 }` so I could do math over that. Is there another way out?

Has anyone skinned this cat in a clever way? 😃

Thanks!

-ave

---

<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 5, 2017, 10:15pm UTC](https://discuss.elastic.co/t/operations-on-doc-count/61969/2 "2017-07-05T22:15:44Z")

</div>


