# "Other" bucket: why do you send a special request for that?

**URL:** <https://discuss.elastic.co/t/other-bucket-why-do-you-send-a-special-request-for-that/155220>\
**Category:** Kibana\
**Created:** [November 2, 2018, 6:13pm UTC](https://discuss.elastic.co/t/other-bucket-why-do-you-send-a-special-request-for-that/155220 "2018-11-02T18:13:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jetnet](https://avatars.discourse-cdn.com/v4/letter/j/a87d85/32.png) [@jetnet](https://discuss.elastic.co/u/jetnet)\
**Post date:** [November 2, 2018, 6:13pm UTC](https://discuss.elastic.co/t/other-bucket-why-do-you-send-a-special-request-for-that/155220/1 "2018-11-02T18:13:32Z")

</div>

Hello Kibana dev team!

I'm wondering, why don't you use the value `sum_other_doc_count` from the very first request and sending a special `must_not` query for that?  
I'm asking because I don't get the `other` bucket (with aggs "size=1") when data is like that:

```auto
PUT test/doc/1
{
  "filterNames": [
    "filter1"
  ]
}

PUT test/doc/2
{
  "filterNames": [
    "filter1",
    "filter2"
  ]
}

```

I expect the "other" bucket would contain one doc (with "filter2", which is correctly showed by `sum_other_doc_count`), but because of the second "other-filter" query the "filter2" document gets filtered out and no "other" bucket gets displayed ☹  
Do you think, it is the expected behaviour?

Thanks!

P.S. I found an [explanation](https://discuss.elastic.co/t/how-does-other-field-work-in-kibanas-piechart/138859/9) how the "other" bucket works, but it is still not clear, why it has been implemented like that.

---

<div class="post-metadata">

**Author:** ![nickpeihl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickpeihl/32/112622_2.png) [@nickpeihl](https://discuss.elastic.co/u/nickpeihl)\
**Post date:** [November 2, 2018, 8:12pm UTC](https://discuss.elastic.co/t/other-bucket-why-do-you-send-a-special-request-for-that/155220/2 "2018-11-02T20:12:18Z")

</div>

Hi jetnet,

There is a lot more discussion on why this method was chosen in the [GitHub pull request](https://github.com/elastic/kibana/pull/15525) where this feature was introduced.

---

<div class="post-metadata">

**Author:** ![jetnet](https://avatars.discourse-cdn.com/v4/letter/j/a87d85/32.png) [@jetnet](https://discuss.elastic.co/u/jetnet)\
**Post date:** [November 2, 2018, 9:36pm UTC](https://discuss.elastic.co/t/other-bucket-why-do-you-send-a-special-request-for-that/155220/3 "2018-11-02T21:36:46Z")

</div>

yes, I thought it'd been done on purpose.  
so, today I discovered a limitation of that implementation.  
will try to workaround...

---

<div class="post-metadata">

**Author:** ![timroes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timroes/32/19712_2.png) [@timroes](https://discuss.elastic.co/u/timroes)\
**Post date:** [November 5, 2018, 8:06am UTC](https://discuss.elastic.co/t/other-bucket-why-do-you-send-a-special-request-for-that/155220/4 "2018-11-05T08:06:06Z")

</div>

Hi,

let me shortly clarify a bit more in detail to your questions.

**Why can't we use `sum_other_doc_count`?**

This would only work for "Count" but for no other metric aggregation the user wants to use. Since our Other Bucket should also work with all the other metric aggregations, we need to do this two query method, to actually calculate the same metrics for all "other" documents.

**What documents will be found**

To your question if we would expect your doc 2 to be filtered out in Other Bucket: Currently yes, that's expected behavior. But to be honest the way Array values work in Elasticsearch might not always be what you would be expecting depending on your use-case. Sometimes it actually might be the solution you want. So we are doing the "default" ES behavior on filtering out those values, also since I don't currently see any other proper solution (that would work with every metric).

Cheers,  
Tim

---

<div class="post-metadata">

**Author:** ![jetnet](https://avatars.discourse-cdn.com/v4/letter/j/a87d85/32.png) [@jetnet](https://discuss.elastic.co/u/jetnet)\
**Post date:** [November 6, 2018, 8:19am UTC](https://discuss.elastic.co/t/other-bucket-why-do-you-send-a-special-request-for-that/155220/5 "2018-11-06T08:19:00Z")

</div>

hello Tim,

thank you so much, that makes sense.

---

<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 4, 2018, 8:19am UTC](https://discuss.elastic.co/t/other-bucket-why-do-you-send-a-special-request-for-that/155220/6 "2018-12-04T08:19:02Z")

</div>

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