Analytics on new customers versus returning customers

Dear community,

I struggle to find a solution for an aggregation use-case...

We index transactions in Elasticsearch from an e-commerce like this :

{ "email" : "client1@gmail.com", "amount" : 15.99, "timestamp" :
"2015-03-18T06:15:03Z" }

We would like to calculate the ratio of new customers versus returning
customers in a selected time range.
In others words, calculate how much customers made a single transaction
versus customers with more than one transaction.
Moreover, we would like to calculate the average amount of transaction for
new customers versus returning customers.

A term aggregation on email will produce buckets per email, but we need to
retrieve all customers to be able to calculate the ratio...

Do you have any idea on how to achieve this without ?

Is there a way to create two buckets, one grouping new customers, and one
grouping returning customers ?

Best Regards

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/89da7fff-b0f4-495b-9986-c6dd20c3735a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.