# Creating a histogram on count of terms

**URL:** <https://discuss.elastic.co/t/creating-a-histogram-on-count-of-terms/12006>\
**Category:** Elasticsearch\
**Created:** [May 17, 2013, 6:40am UTC](https://discuss.elastic.co/t/creating-a-histogram-on-count-of-terms/12006 "2013-05-17T06:40:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![atifa\_perveen](https://avatars.discourse-cdn.com/v4/letter/a/e495f1/32.png) [@atifa\_perveen](https://discuss.elastic.co/u/atifa_perveen)\
**Post date:** [May 17, 2013, 6:40am UTC](https://discuss.elastic.co/t/creating-a-histogram-on-count-of-terms/12006/1 "2013-05-17T06:40:44Z")

</div>

I am currently working on a project in which I am storing user activity  
logs in elasticsearch. the user field in the log is like  
{"user":"abc@yahoo.com"}. I have a timestamp field for each activity, that  
describes when this activity was recorded. Can i generate date histogram on  
the basis of number of users in a particular time period. eg the histogram  
entry must show the number of users on that time. I can have this  
implemented by obtaining facet counts, but i need to get counts on various  
intervals and various ranges with minimum queries. Please guide me in this  
regard. Thanks.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![aash\_dhariya](https://avatars.discourse-cdn.com/v4/letter/a/c37758/32.png) [@aash\_dhariya](https://discuss.elastic.co/u/aash_dhariya)\
**Post date:** [May 17, 2013, 8:41am UTC](https://discuss.elastic.co/t/creating-a-histogram-on-count-of-terms/12006/2 "2013-05-17T08:41:44Z")

</div>

Use range query (  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/range-query/)) to  
obtain users in a specific range and then apply facets on it to obtain  
counts

On Fri, May 17, 2013 at 12:10 PM, [atifa.perveen@elastica.co](mailto:atifa.perveen@elastica.co) wrote:

> I am currently working on a project in which I am storing user activity  
> logs in elasticsearch. the user field in the log is like {"user":"  
> [abc@yahoo.com](mailto:abc@yahoo.com)"}. I have a timestamp field for each activity, that  
> describes when this activity was recorded. Can i generate date histogram on  
> the basis of number of users in a particular time period. eg the histogram  
> entry must show the number of users on that time. I can have this  
> implemented by obtaining facet counts, but i need to get counts on various  
> intervals and various ranges with minimum queries. Please guide me in this  
> regard. Thanks.
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
Thanks,  
Aash

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:36am UTC](https://discuss.elastic.co/t/creating-a-histogram-on-count-of-terms/12006/3 "2017-07-06T02:36:10Z")

</div>


