# Custom TopDocsCollector / Custom sorting

**URL:** <https://discuss.elastic.co/t/custom-topdocscollector-custom-sorting/35403>\
**Category:** Elasticsearch\
**Created:** [November 24, 2015, 9:18am UTC](https://discuss.elastic.co/t/custom-topdocscollector-custom-sorting/35403 "2015-11-24T09:18:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rosherd](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rosherd/32/46087_2.png) [@rosherd](https://discuss.elastic.co/u/rosherd)\
**Post date:** [November 24, 2015, 9:18am UTC](https://discuss.elastic.co/t/custom-topdocscollector-custom-sorting/35403/1 "2015-11-24T09:18:06Z")

</div>

Hi,

I'm new to ES but wondering if the community knew if there a way with ES today to implement something like the ReRanking API [[https://cwiki.apache.org/confluence/display/solr/RankQuery+API](https://cwiki.apache.org/confluence/display/solr/RankQuery+API)].

Specifically I need a custom TopDocsCollector probably in core/src/main/java/org/elasticsearch/search/query/QueryPhase:execute so that we might be able to implement our custom ranking strategy. It would also allow for full control for a custom sort implementation too.

Cheers,  
Dan

---

<div class="post-metadata">

**Author:** ![mainec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mainec/32/5557_2.png) [@mainec](https://discuss.elastic.co/u/mainec)\
**Post date:** [November 24, 2015, 12:18pm UTC](https://discuss.elastic.co/t/custom-topdocscollector-custom-sorting/35403/2 "2015-11-24T12:18:52Z")

</div>

I'd start with looking at [script scoring](https://www.elastic.co/guide/en/elasticsearch/guide/current/script-score.html) first, maybe this already helps.

Isabel

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 11:36pm UTC](https://discuss.elastic.co/t/custom-topdocscollector-custom-sorting/35403/3 "2017-07-05T23:36:18Z")

</div>


