Looking at the  top hits aggregation 
<http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/search-aggregations-metrics-top-hits-aggregation.htm>.
 
I guess this is what I want. I will try this out now.

On Wednesday, September 24, 2014 1:18:27 PM UTC+3, Tugberk Ugurlu wrote:
>
> In my sport index, I have the following documents indexed as football_team 
> type:
>
> https://gist.github.com/tugberkugurlu/4fd750a5ada3ee5de17a#file-index-js
>
> Here, each football team has a name and some strength values. Besides 
> that, there is a player_ids collection for each team. The team stregth has 
> been calculated by taking the avarage of players' strengths during the ETL 
> process. You can also see that there are multiple football teams with the 
> same name here but the player_ids collection is different.
>
> When we run the following query:
>
>
> https://gist.github.com/tugberkugurlu/4fd750a5ada3ee5de17a#file-search_query-js
>
> We will get the following result:
>
>
> https://gist.github.com/tugberkugurlu/4fd750a5ada3ee5de17a#file-search_result-js
>
> Which is expected. However, what I would like to get here is top 1 row of 
> each group (grouped by the team name). The result I would like to get for 
> the above query is this:
>
>
> https://gist.github.com/tugberkugurlu/4fd750a5ada3ee5de17a#file-expected_result-js
>
> Any idea?
>
> Also, Here is the whole question in gist: 
> https://gist.github.com/tugberkugurlu/4fd750a5ada3ee5de17a#file-football_teams-md
>
> Tugberk
>

-- 
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/b018ce04-24c2-43d4-956a-bc6a5dda8468%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to