# How to Display Trending Posts

**URL:** https://discuss.elastic.co/t/how-to-display-trending-posts/347898
**Category:** Elastic Search
**Tags:** elastic-app-search
**Created:** [November 24, 2023, 5:34am UTC](https://discuss.elastic.co/t/how-to-display-trending-posts/347898 "2023-11-24T05:34:44Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![aisyaharifin](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@aisyaharifin](https://discuss.elastic.co/u/aisyaharifin)
#### Post date: [November 24, 2023, 5:34am UTC](https://discuss.elastic.co/t/how-to-display-trending-posts/347898/1 "2023-11-24T05:34:44Z")

</div>

Hello Elastic,

I have this requirement where my user would like to display the top trending post, can refer image below :

 ![MicrosoftTeams-image (98)](https://us1.discourse-cdn.com/elastic/original/3X/8/7/87d1a1fc5fedcca90b84e4ceaacbf776566f5c5c.png)

I showed them that we do have analytics based on the queries, but to specifically shown the top trending post with most likes, should that be done from the front end side? Correct me if I'm wrong or we able to capture analytics also based on top view post?

 ![Screenshot 2023-11-24 at 1.29.25 PM](https://us1.discourse-cdn.com/elastic/original/3X/2/7/27b262ea9b3c33c2cd419fb303e9657acc5e9a5c.png)

I believe we can capture the top search queries but the top trending post, can elastic enterprise search do that?

Thank you.

---

<div class="post-metadata">

### Author: ![Carlos\_D](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carlos_d/32/126245_2.png) [@Carlos\_D](https://discuss.elastic.co/u/Carlos_D)
#### Post date: [November 24, 2023, 8:10am UTC](https://discuss.elastic.co/t/how-to-display-trending-posts/347898/2 "2023-11-24T08:10:12Z")

</div>

HI @aisyaharifin !

You'll need to add analytics for that, as App Search can't tell about the likes / views / comments otherwise.

App Search does not provide specific analytics for that use case, but just [queries, clicks and counts](https://www.elastic.co/guide/en/app-search/current/analytics.html). [Elasticsearch Behavioral Analytics](https://www.elastic.co/guide/en/elasticsearch/reference/current/behavioral-analytics-overview.html) only allows for search, click and page view events.

You can create your own index and collect analytics from the frontend side, sending an event to be stored on an Elasticsearch index, and then query that index using [aggregations](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations.html) to summarize statistics and include them into your App Search index. That way you can use App Search sorting and filtering to satisfy your requirement.

---

<div class="post-metadata">

### Author: ![aisyaharifin](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@aisyaharifin](https://discuss.elastic.co/u/aisyaharifin)
#### Post date: [November 30, 2023, 12:58am UTC](https://discuss.elastic.co/t/how-to-display-trending-posts/347898/3 "2023-11-30T00:58:20Z")

</div>

Hi @Carlos_D , so to clarify on this, based on my understanding, I can display the trending post by implementing Elastic Behavioral Analytics to collect the user behavior from the front end side? Correct me if I'm wrong, thank you.

---

<div class="post-metadata">

### Author: ![Carlos\_D](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carlos_d/32/126245_2.png) [@Carlos\_D](https://discuss.elastic.co/u/Carlos_D)
#### Post date: [November 30, 2023, 9:40am UTC](https://discuss.elastic.co/t/how-to-display-trending-posts/347898/4 "2023-11-30T09:40:06Z")

</div>

That is correct. You need to:

- Collect user behaviour using Behavioral Analytics from the front end
- Merge the retrieved information from analytics into your posts Engine, so posts have additional information on the number of views, etc. This can be done as a scheduled job
- Use the new information included in the Engine to do sorting.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [December 28, 2023, 9:40am UTC](https://discuss.elastic.co/t/how-to-display-trending-posts/347898/5 "2023-12-28T09:40:14Z")

</div>

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