How to decay the knn search result using decay function?

Hello,
We are using OpenSearch’s knn search to match the similar records but we also want to limit the results up to N years and deprioritize older records so that even if a result’s score is high based on similarity it should be scored low if it’s a few years older. So can this be done using a single query or what would be the recommended approach to implement this?

Thanks

Hi @szljoshi

Yes, I think you can do this using boost, which will allow you to boost query scores in a compound query. Full-text queries - OpenSearch documentation.

1 Like