# Kibana bar chart inaccurate when searching on field? \[SOLVED\]

**URL:** <https://discuss.elastic.co/t/kibana-bar-chart-inaccurate-when-searching-on-field-solved/42908>\
**Category:** Kibana\
**Created:** [February 27, 2016, 3:11am UTC](https://discuss.elastic.co/t/kibana-bar-chart-inaccurate-when-searching-on-field-solved/42908 "2016-02-27T03:11:33Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChrisR](https://avatars.discourse-cdn.com/v4/letter/c/ecd19e/32.png) [@ChrisR](https://discuss.elastic.co/u/ChrisR)\
**Post date:** [February 27, 2016, 3:11am UTC](https://discuss.elastic.co/t/kibana-bar-chart-inaccurate-when-searching-on-field-solved/42908/1 "2016-02-27T03:11:33Z")

</div>

I'm seeing an issue with bar chart values when searching on a field. The bar chart values are accurate when there is nothing in the search field, but when I search for field:"xyz", the numbers in the bars are close but not exactly correct. If I then add that field to the aggregation by slicing the bars by it, the numbers are exactly correct.

Anyone else seeing this behavior?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 28, 2016, 3:42am UTC](https://discuss.elastic.co/t/kibana-bar-chart-inaccurate-when-searching-on-field-solved/42908/2 "2016-02-28T03:42:34Z")

</div>

What sort of agg are you using?

---

<div class="post-metadata">

**Author:** ![ChrisR](https://avatars.discourse-cdn.com/v4/letter/c/ecd19e/32.png) [@ChrisR](https://discuss.elastic.co/u/ChrisR)\
**Post date:** [February 29, 2016, 11:39am UTC](https://discuss.elastic.co/t/kibana-bar-chart-inaccurate-when-searching-on-field-solved/42908/3 "2016-02-29T11:39:59Z")

</div>

I'm using unique count.

---

<div class="post-metadata">

**Author:** ![ChrisR](https://avatars.discourse-cdn.com/v4/letter/c/ecd19e/32.png) [@ChrisR](https://discuss.elastic.co/u/ChrisR)\
**Post date:** [March 1, 2016, 4:12pm UTC](https://discuss.elastic.co/t/kibana-bar-chart-inaccurate-when-searching-on-field-solved/42908/4 "2016-03-01T16:12:48Z")

</div>

There is no inaccuracy, this was an error in my testing. Sorry about that!

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [March 1, 2016, 8:40pm UTC](https://discuss.elastic.co/t/kibana-bar-chart-inaccurate-when-searching-on-field-solved/42908/5 "2016-03-01T20:40:48Z")

</div>

What was the error?

---

<div class="post-metadata">

**Author:** ![ChrisR](https://avatars.discourse-cdn.com/v4/letter/c/ecd19e/32.png) [@ChrisR](https://discuss.elastic.co/u/ChrisR)\
**Post date:** [March 1, 2016, 9:17pm UTC](https://discuss.elastic.co/t/kibana-bar-chart-inaccurate-when-searching-on-field-solved/42908/6 "2016-03-01T21:17:49Z")

</div>

Purely a user error. I didn't fully understand the data until I dug into it using the Kibana table visualization.

In short, this is the gist of what I was doing...

1. Bar charts on unique count of a uid field, search on \*, total was 15.
2. Bar charts on unique count of a uid field, search on type\_field:type\_value, total was 3.
3. Bar charts on unique count of a uid field, search on NOT type\_field:type\_value, total was 14.

At first I was expecting the second two queries to add up to 15.

However, I later realized that the uid field was not unique in the index and there were a couple of uids that had a record with the type\_value and another without the type\_value. Pretty obvious in hindsight.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [March 1, 2016, 9:18pm UTC](https://discuss.elastic.co/t/kibana-bar-chart-inaccurate-when-searching-on-field-solved/42908/7 "2016-03-01T21:18:58Z")

</div>

All good, it's useful for people to know how you solved it though as someone else might run into it.  
Same goes for not editing the topic, better to put something like `[SOLVED]` there 🙂

---

<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, 2:00pm UTC](https://discuss.elastic.co/t/kibana-bar-chart-inaccurate-when-searching-on-field-solved/42908/8 "2017-07-06T14:00:40Z")

</div>

Closed on July 6, 2017, 2:00pm UTC


