I was only thinking loud. I mean that I don't know what your model looks like.
May be you could illustrate your use case with some actual data and we can move 
forward from here?

What kind of documents are you actually indexing and searching for? What fields 
do you have?


-- 
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr


Le 24 juin 2014 à 14:42:14, Thomas ([email protected]) a écrit:

Hi David 

Thank you for your reply, so based on your suggestion I should maintain a 
document (e.g. user) with some aggregated values and I should update it as we 
move along with our indexing of our data, correct?

This though would only give me totals. I cannot apply something like a range. I 
found as well a similar discussion here 
https://groups.google.com/forum/#!msg/elasticsearch/UsrCG2Abj-A/IDO9DX_PoQwJ. 
Maybe something similar with the terms and histogram aggregation could support 
this logic like instead of giving :

{
    "aggs" : {
        "requests_distribution" : {
            "distribution" : {
                "field" : "user_id",
                "interval" : 50
            }
        }
    }
}

and the result could be:

{
    "aggregations": {
        "requests_distribution" : {
            "buckets": [
                {
                    "key": 0,
                    "doc_count": 2
                },
                {
                    "key": 50,
                    "doc_count": 400
                },
                {
                    "key": 150,
                    "doc_count": 30
                }
            ]
        }
    }
}

Where the key represents a unique number of users like for 0 to 50 users have 2 
documents per user etc.

Just an idea

Thanks
Thomas

On Tuesday, 24 June 2014 13:32:13 UTC+3, Thomas wrote:
Hi,

I wanted to ask whether it is possible to get with the aggregation framework 
the distribution of one specific type of documents sent per user, I'm 
interested for occurrences of documents per user, e.g. :

1000 users sent 1 document 
500 ussers  sent 2 documents
X number of unique users sent Y documents (each)
etc.

on each document i index the user_id

Is there a way to support such a query, or partially support it? get the first 
10 rows of this type of list not the exhaustive list. Can you give me some 
hint? 

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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/ae8b56f1-a783-4ade-b948-079f6457ae27%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
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/etPan.53a97c1d.2443a858.950f%40MacBook-Air-de-David.local.
For more options, visit https://groups.google.com/d/optout.

Reply via email to