Approach for incorporating recency in search

Hi,

I'm trying to improve the relevance of search results using user's recent activity, in order to personalize the search experience. I have the data of the user's recent activity, in addition to an exhaustive database of all the possible search items. I want to boost the relevant matches from recent activity with a higher factor than other matches.

Following are the approaches I could come up with:

  1. Performing index boost on the user based index of recent data, and giving it a higher boost factor than rest of the indices.

  2. Making a query to Elastic Search using AND logic.

Eg:
"should": [
{
"bool": {
"must": [
{
"multi_match": {
"query": "1",
"fields": [
"field1$^1000"
],
"type": "phrase"
}
},
{
"multi_match": {
"query": "test",
"fields": [
"field2$^100",
"field3$^10",
],
"type": "phrase"
}
}
]
}
},
{
"multi_match": {
"query": "test",
"fields": [
"field2$^100",
"field3$^10",
,
"type": "phrase"
}
}
]

In this, the results with value of field1=1 and having a valid match for term "test" across field2 and/or field3 will be boosted with a higher factor than the conventional match.

  1. Boosting query with a negative boost to demote certain results. But this somehow fails to apply the negative boost factor.

  2. Designing a script to assign higher score to items which are recent, and using it as a plugin in the desired query.

The first two approaches are posing some serious performance issues, and the third one is not working. The best available option right now is the last one.

I want to know if there's any other better approach which can be used here.

Thank you!

Hi,

Maybe you can take a look to this plugin:

2 Likes