Sort results by page views

I have an Elasticsearch cluster with lots of pages indexed. I am using Elasticsearch to provide best results to the users currently. Each page is viewed many times in a day. I want to store the page view count and take this value (page view count) to boost the results.
For example: if a result is ranked 3rd but its page view count is very much, then it should rank 2nd or maybe 1st.

I need help in achieving this target.

Hi @dojutsu-user,

I think the more efficient way i to store the views as logs in hourly, daily, weekly, monthly index depends on your needs.

You can store what ever data you think it's had a value.

{
"url_page": "sort-results-by-page-views/197859",
"product": "sort-results-by-page-views",
"product_id": "197859"
"created_at": "2019-09-03 12:34:11"
}

You can run a script with an aggregation and update a weight field in your indexed pages that you can use on search to boost.

This solution is quick and dirty but depend on your needs it can be ok.

Solution 2 but experimental:

Or:

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