Hi,

Is it possible to do a Terms aggregation in Elasticsearch, but restricted 
to the top N matching documents?
I'm aware of the top_hits aggregator, but it does not allow sub 
aggregations.
So while I can get the top N matches per term, I can't find a way to get 
the terms of the top N matches.

My current query is something like:

GET /myindex/mydoc/_search
{
  "size": 0, 
  "query": {"match": {
    "field_to_search": "some search string"
  }}
  ,"aggs": {
    "term_aggregation": {
      "terms": {
        "field": "Tags",
        "size": 0,
        "order": {
          "summed_score": "desc"
        }
      },
      "aggs":{"summed_score":{"sum":{"script":"doc.score"}} }
      }
  }
}


which aggregates the scores of ALL matching documents by terms in the Tags 
field.

Is there any way to do what I want?

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/8a3df48e-2551-45db-91e7-d827f141dcb8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to