Working on it ... https://github.com/elasticsearch/elasticsearch/pull/8191

On Wednesday, December 10, 2014 4:59:19 PM UTC, Chris H wrote:
>
> 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/574a1596-e705-405c-868b-bb73d3452372%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to