elastic/elasticsearch

Add support for collapse sort to specify how to sort groups relative to each other

Open

#45,646 opened on Aug 16, 2019

View on GitHub
 (26 comments) (31 reactions) (0 assignees)Java (25,882 forks)batch import
:Search Relevance/Ranking>enhancementTeam:Search Relevancehelp wantedhigh hanging fruit

Repository metrics

Stars
 (76,700 stars)
PR merge metrics
 (Avg merge 2d) (1,000 merged PRs in 30d)

Description

This is a feature request.

At the moment, field collapsing will use the same scoring as the main query to choose the document that will appear in the main search results hits.

it would be good to have a score for the main query but another score to choose which one is going to be chosen within the field-collapsed set.

We can use inner_hit to sort the inner hits but this does not change the top document that has been chosen in the main hits. We can then manually choose the inner_hit..hits.hits[0] instead of the top hits.

I think the collapse feature would benefit from having a collapse_sort that will define the hit that will be chosen at the top level.

Thanks

Contributor guide