How to update integer like click count efficiently for ranking


(fancyerii) #1

I want to use a field to record the number of click of a document. it's not searched but only used to calculate the score. But it's updated frequently. How should I define the mapping of this field and how can I use this field to calculate score?


(Isabel Drost-Fromm) #2

How frequent is frequently?

Why I'm asking this: Often at first sight implementing such a feature one would like to reflect the exact click count in the index. But looking at the feature again, it might be acceptable to update these clicks only every so often in bulk. Even from a user's perspective limiting the impact of single clicks might make sense - many people I know expect search results for the same query to remain constant within at least a short amount of time (between page reloads within seconds/minutes).

As for how to use something like this for scoring: I'd make sure to normalise clicks across documents instead of using raw counts. I'd think about fading out the impact of older clicks to avoid having older documents dominate searches just because they had more time to accumulate clicks. Depending on your use-case I'd spend some time thinking about how much of an incentive you are setting for people to spam this ranking signal.

I'd probably get started with

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html

Hope this helps,
Isabel


(system) #3