Time weighting after ANN search

Hi, I'm trying to write a search query to:

  • perform an ANN search on a dense vector field
  • re-rank the returned documents to weight more recent documents higher, according to a custom exponential decay function applied to a 'date' field.

What is the best practice for doing this - using the query rescorer? Does Elasticsearch have built-in support for time weighting?


At the moment _knn_search endpoint doesn't support rescorers. So you would need to that on your application side.

But we are working on combining _search and _knn_search endpoints, which means there will be an option to use rescorer.

For time weighting, you can either use 1) script_score query with decay functions on date fields or 2) function_score query's decay functions

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