# Get counts of new users per day

**URL:** <https://discuss.elastic.co/t/get-counts-of-new-users-per-day/15389>\
**Category:** Elasticsearch\
**Created:** [January 24, 2014, 12:09am UTC](https://discuss.elastic.co/t/get-counts-of-new-users-per-day/15389 "2014-01-24T00:09:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Josh\_Harrison](https://avatars.discourse-cdn.com/v4/letter/j/0ea827/32.png) [@Josh\_Harrison](https://discuss.elastic.co/u/Josh_Harrison)\
**Post date:** [January 24, 2014, 12:09am UTC](https://discuss.elastic.co/t/get-counts-of-new-users-per-day/15389/1 "2014-01-24T00:09:21Z")

</div>

I'm working with the twitter river data. Trying to figure out how to  
construct a query that would let me generate a count of all new users  
within a given time period, where in this case, new means "user has not had  
a post captured before the start of this query window".  
So basically, I want to get a facet result of user.screen\_name where a name  
will be dropped from the facet entirely if an instance of it occurs outside  
a specified time range.  
I've got no idea where to start. Anyone have any pointers?

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/f1166ce3-f529-4412-b721-37f3e1cfcc79%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f1166ce3-f529-4412-b721-37f3e1cfcc79%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Itamar\_Syn\_Hershko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/itamar_syn_hershko/32/725_2.png) [@Itamar\_Syn\_Hershko](https://discuss.elastic.co/u/Itamar_Syn_Hershko)\
**Post date:** [January 24, 2014, 12:26am UTC](https://discuss.elastic.co/t/get-counts-of-new-users-per-day/15389/2 "2014-01-24T00:26:28Z")

</div>

You can't really do that, not without doing some pre-calculations like  
creating a user document for every user that has a tweet in the system or  
similar.

--

Itamar Syn-Hershko  
[http://code972.com](http://code972.com) | @synhershko [https://twitter.com/synhershko](https://twitter.com/synhershko)  
Freelance Developer & Consultant  
Author of RavenDB in Action [http://manning.com/synhershko/](http://manning.com/synhershko/)

On Fri, Jan 24, 2014 at 2:09 AM, Josh Harrison [hijakk@gmail.com](mailto:hijakk@gmail.com) wrote:

> I'm working with the twitter river data. Trying to figure out how to  
> construct a query that would let me generate a count of all new users  
> within a given time period, where in this case, new means "user has not had  
> a post captured before the start of this query window".  
> So basically, I want to get a facet result of user.screen\_name where a  
> name will be dropped from the facet entirely if an instance of it occurs  
> outside a specified time range.  
> I've got no idea where to start. Anyone have any pointers?
> 
> --  
> 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).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/f1166ce3-f529-4412-b721-37f3e1cfcc79%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f1166ce3-f529-4412-b721-37f3e1cfcc79%40googlegroups.com)  
> .  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAHTr4ZvkqwkRbYLCS%3DHv7%3DuV%2BW08iFLDENWu%2BSuGZYjePtv7EA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHTr4ZvkqwkRbYLCS%3DHv7%3DuV%2BW08iFLDENWu%2BSuGZYjePtv7EA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Andre\_Leite](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andre_leite/32/10967_2.png) [@Andre\_Leite](https://discuss.elastic.co/u/Andre_Leite)\
**Post date:** [August 18, 2016, 11:48pm UTC](https://discuss.elastic.co/t/get-counts-of-new-users-per-day/15389/3 "2016-08-18T23:48:56Z")

</div>

I got almost there, I guess.. so close yet so far..

> <https://gist.github.com/andremilk/1869374ed44a1ec60cbffaecd2b7e529>

  
(source was [http://stackoverflow.com/questions/34700689/how-to-build-date-histogram-query-which-counts-new-properties](http://stackoverflow.com/questions/34700689/how-to-build-date-histogram-query-which-counts-new-properties))

Bear in mind that this particular query is not very performant

---

<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 5, 2017, 10:26pm UTC](https://discuss.elastic.co/t/get-counts-of-new-users-per-day/15389/4 "2017-07-05T22:26:50Z")

</div>


