Hello,

I'm starting to use aggregations for some fairly advanced querying, and I'm 
finding it very simple so far.  But there's one class of queries I'm 
struggling with.

Given this simplified data model:

Leads
 - opened_at
 - closed_at
 - value ($)

I would like to show the number and value of open leads over time.

With a date_histogram aggregation, I can see the number opened and closed 
over time.  But what I'd like to know is not how many were *opened* during 
a given bucket, but how many are *currently open*--that is, how many were 
opened during or before a given bucket and have not yet been closed, so 
that every bucket gives an accurate snapshot of open leads at a point in 
time.

Is there a way to figure this out using Elasticsearch?  For example, can I 
access the start and end dates of a bucket in an aggregation, so that I can 
filter on e.g. range: { opened_at: { lt: BUCKET_START } } and range: { 
closed_at: { gt: BUCKET_END } }?

Thanks in advance for your help!

David

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/02c45103-7add-4b2a-bd38-7d973ab1c971%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to