# Counting results by a value

**URL:** <https://discuss.elastic.co/t/counting-results-by-a-value/354256>\
**Category:** Kibana\
**Created:** [February 27, 2024, 4:43pm UTC](https://discuss.elastic.co/t/counting-results-by-a-value/354256 "2024-02-27T16:43:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![user-27022024](https://avatars.discourse-cdn.com/v4/letter/u/ce7236/32.png) [@user-27022024](https://discuss.elastic.co/u/user-27022024)\
**Post date:** [February 27, 2024, 4:43pm UTC](https://discuss.elastic.co/t/counting-results-by-a-value/354256/1 "2024-02-27T16:43:53Z")

</div>

We store our load balancer logs in elasticsarch and use kibana for querying.

In Kibana - Discover I can add a filter for IP address which will display the IP address from each request. But is it possible to just count each unique value so we can identify the number of requests per IP address. I figure this should be very straightforward but I cannot work out how to do it. I was expecting there to be a count() of similar function

---

<div class="post-metadata">

**Author:** ![qd-danh](https://avatars.discourse-cdn.com/v4/letter/q/43a26b/32.png) [@qd-danh](https://discuss.elastic.co/u/qd-danh)\
**Post date:** [February 27, 2024, 7:05pm UTC](https://discuss.elastic.co/t/counting-results-by-a-value/354256/2 "2024-02-27T19:05:53Z")

</div>

Hello. The API query for unique values would look like this

```auto
GET your-index/_search
{
  "size" : 0,
  "aggs" : {
    "my-agg" : {
      "cardinality": {
        "field" : "ipAddress"
      }
    }
  }
}

```

I know you're asking to do this in Discover, and I struggle with this as well. You can do a terms lens visual but it only shows the "top N" where you can set N but not up to a huge number since that's difficult to visualize.

Curious if / when you get the answer to this.

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [February 27, 2024, 8:18pm UTC](https://discuss.elastic.co/t/counting-results-by-a-value/354256/3 "2024-02-27T20:18:10Z")

</div>

Hi @user-27022024 Welcome to the community.

What version Kibana are you on?

Depending on what version you are on, this can be very simple like click and and see the distribution.

In discover you should just be able to click on the fields name in the field list and it will show you percentage breakdown

 ![Screenshot 2024-02-27 at 9.31.02 PM](https://us1.discourse-cdn.com/elastic/original/3X/b/f/bfb2b46a383b7830e60471e4252e14dab9fe9970.png)

If you click on visualize, it will create a chart , just change horizontal to like top 25  
This is a bar Chart but you can Do Table, Pie Chart etc.etc..

 ![Screenshot 2024-02-27 at 9.31.28 PM](https://us1.discourse-cdn.com/elastic/original/3X/6/c/6cee88b08afec92d65bd051c9314b98c383c02bc.jpeg)

---

<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:** [March 26, 2024, 8:19pm UTC](https://discuss.elastic.co/t/counting-results-by-a-value/354256/4 "2024-03-26T20:19:09Z")

</div>

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