# Graphing Unique and Total Website Hits

**URL:** <https://discuss.elastic.co/t/graphing-unique-and-total-website-hits/155940>\
**Category:** Kibana\
**Created:** [November 8, 2018, 5:05pm UTC](https://discuss.elastic.co/t/graphing-unique-and-total-website-hits/155940 "2018-11-08T17:05:49Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![wwalker](https://avatars.discourse-cdn.com/v4/letter/w/43a26b/32.png) [@wwalker](https://discuss.elastic.co/u/wwalker)\
**Post date:** [November 8, 2018, 5:05pm UTC](https://discuss.elastic.co/t/graphing-unique-and-total-website-hits/155940/1 "2018-11-08T17:05:50Z")

</div>

I have some web traffic data that I am ingesting and would like to display a table showing the URL that was visited, the total number of hits (based off IP) and the unique number of hits (again based off IP). I have a table configured as shown below but I think it's incorrect because Count is just counting all the values in all the events for the given time period. How would I get it to just count the number of events for the time period? The IP field is currently just indexed as a string, if it needs to be indexed as an IP that can also be done.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/9/8/9827ddfeb1c37f8fa9e3afed139224cec4e430c4.png)

---

<div class="post-metadata">

**Author:** ![Joe\_Fleming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joe_fleming/32/3561_2.png) [@Joe\_Fleming](https://discuss.elastic.co/u/Joe_Fleming)\
**Post date:** [November 8, 2018, 6:38pm UTC](https://discuss.elastic.co/t/graphing-unique-and-total-website-hits/155940/2 "2018-11-08T18:38:32Z")

</div>

If I'm understanding correctly what you're asking for, it looks like you have it...

> total number of hits (based off IP)

That part is suspect though. What do you mean "total based off IP"? The total (count) you're looking at there is the overall total hit count, regardless of IP. Is that not what you mean?

---

<div class="post-metadata">

**Author:** ![wwalker](https://avatars.discourse-cdn.com/v4/letter/w/43a26b/32.png) [@wwalker](https://discuss.elastic.co/u/wwalker)\
**Post date:** [November 8, 2018, 7:58pm UTC](https://discuss.elastic.co/t/graphing-unique-and-total-website-hits/155940/3 "2018-11-08T19:58:06Z")

</div>

Maybe I'm misunderstanding the explanation of the count aggregation then.

> [@Elasticsearch Reference](#):
>
> A `single-value` metrics aggregation that counts the number of values that are extracted from the aggregated documents.

I understood this to mean that it was counting all fields in all events. So if I have 2 events with 10 fields each, I would get a `count` of 20.

---

<div class="post-metadata">

**Author:** ![Joe\_Fleming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joe_fleming/32/3561_2.png) [@Joe\_Fleming](https://discuss.elastic.co/u/Joe_Fleming)\
**Post date:** [November 8, 2018, 9:19pm UTC](https://discuss.elastic.co/t/graphing-unique-and-total-website-hits/155940/4 "2018-11-08T21:19:42Z")

</div>

Ah, no, it's counting all the documents that match a certain combination of buckets, not the number of fields in those documents.

In your case, you are bucketing on ClientRequestURI, so the Count you see on each row is a count of _all_ of the documents that have that value for that field. So that first row is saying you have 38,764 unique IP's and 278,969 total documents with that value for ClientRequestURI.

---

<div class="post-metadata">

**Author:** ![wwalker](https://avatars.discourse-cdn.com/v4/letter/w/43a26b/32.png) [@wwalker](https://discuss.elastic.co/u/wwalker)\
**Post date:** [November 8, 2018, 9:35pm UTC](https://discuss.elastic.co/t/graphing-unique-and-total-website-hits/155940/5 "2018-11-08T21:35:42Z")

</div>

lol ok so....I've got exactly what I want?

---

<div class="post-metadata">

**Author:** ![Joe\_Fleming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joe_fleming/32/3561_2.png) [@Joe\_Fleming](https://discuss.elastic.co/u/Joe_Fleming)\
**Post date:** [November 8, 2018, 9:38pm UTC](https://discuss.elastic.co/t/graphing-unique-and-total-website-hits/155940/6 "2018-11-08T21:38:00Z")

</div>

Yeah, I think so, if you're just trying to see the total count for each URI, and the total count of unique IPs for each URI.

It was the "(based off IP)" part that was throwing me, it sounds like you're just looking for total count, which you have.

If you are looking for the total count _of each unique IP address_ (ie. the number of hits from each IP), that's different, and that's not what you are seeing.

---

<div class="post-metadata">

**Author:** ![wwalker](https://avatars.discourse-cdn.com/v4/letter/w/43a26b/32.png) [@wwalker](https://discuss.elastic.co/u/wwalker)\
**Post date:** [November 8, 2018, 9:42pm UTC](https://discuss.elastic.co/t/graphing-unique-and-total-website-hits/155940/7 "2018-11-08T21:42:20Z")

</div>

Ya sorry. I think what I meant was I want to see the number of hits a URI has received and then the number of unique hits for the given URI. Of the data available, this is the most reliable data point to use for "uniqueness".

---

<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 6, 2018, 9:42pm UTC](https://discuss.elastic.co/t/graphing-unique-and-total-website-hits/155940/8 "2018-12-06T21:42:32Z")

</div>

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