Home > Blockchain >  Elastic search minimize the boost factor as time pass
Elastic search minimize the boost factor as time pass

Time:12-16

I have elastic search document that looks like this:

...
{
    title : "post 1",
    total_likes : 100,
    total_comments : 129,
    updated_at : "2020-10-19"
},
...

And i use a query that boost the likes and comments with respect to the post creation date so it look like this:

total_likes^6,
total_comments^4,
updated_at

now the issue with this approach, that if some post had a huge number of likes it will stuck on top of the results forever no matter when it is created.

How i can minimize the boost as the time pass, for example a very fresh post will have the full boost factor (6,4) however, a post that has been created 1 year ago will have the factors (2,1) ?

CodePudding user response:

So I think what you are look for is the function score in coordination with the decay factor [doc]

Or if your logic is more complex, you could write it in painless in the function field value factor [doc]

  • Related