Here's a bit of background info:

I'm interested in using aggregations to produce distinct keys for multiple 
"term" fields and then getting a "measure" value for those keys.  This can 
be accomplished by "tree"-ing term aggregations together and whatever 
"measure" terms are applied to the lowest sub-aggregation.

For instance:
"aggs":{
    "field1Agg": {
         "terms": {
             "field": "field1"
         },
         "aggs": {
             "field2Agg": {
                 "terms": {
                     "field": "field2"
                 },
                 "aggs": {
                     "measure1Agg": { "sum": { "field" : "measure1"} }
                 }
             }     
         }
    }
}

Now, when I get this data back, I just recursively flatten the results into 
a single List.  I then apply whatever sorting and limiting after the fact.

The bad:
This actually requires me to request for every record from ElasticSearch, 
which is not ideal.

So is there a particular way to accomplish the sorting/limiting on 
ElasticSearch rather than after I flatten the data?  I saw the "top_hits" 
aggregation, but I'm not sure how it applies...

-- 
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/e8eafbce-3636-4532-847b-409730241a8f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to