Understanding the custom rescore plugin execution flow

Hi,
my name is Pere Urbon, I am currently building a plugin for elasticsearch to implement fair ranking/search strategies. My initial idea has been to build this as a recore plugin due to the fact that the original paper algorithm need all search results to be ready before the fair rescoring takes place.

I have created an initial version of the plugin, including few vanilla test using the great rest-api-spec test framework. In the test all works as expected, however when I run the plugin using kibana the rescorer does not get all the TopDocs search results at once, but in different waves. Does this makes sense? or I am doing something wrong?

I'm also wondering another question, taking into consideration that the algorithm needs all search results before doing the reordering, is it fair to implement it as a rescorer, or would be better as a custom query?

Cheers

-- Pere Urbon

1 Like

Hi!

The rescore happens on each shard individually so you rerank the top-N of each shard. Let's say you have 2 shards you'll rescore 2*top-N.
If you can't adapt your algorithm to work this way and really want to work on the final top-N I'd suggest having a look at the solution implemented in https://github.com/codelibs/elasticsearch-dynarank where the rescoring happens only once on the node that receives the request.

Note: While I don't know all the details, I'd suggest making your algorithm aware of this and potentially decrease its precision/exactness to be able to work on the top-N of each shards. Working on the final top-N sounds hard to me with challenging questions regarding performances and pagination.

Thanks a lot David,
stupid me, I should have thought that at the end the rescoring is like the query phase, happening at each shard. I find the approach interesting from your link, thanks a lot.

I might also work on adapting the method to work per shard, in terms of performance should be more efficient, however the work expects to be interesting :smile_cat:

Again, thank a lot,

-- Pere

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.