Help With Popular Content type List with ES


(Praveen Baratam) #1

Hello Everyone,

I use the following schema to store documents in ElasticSearch.

{
"id":"master-chef-america",
"title":"Master Chef - America",
"description":"Event related rant, comments and discussion..",
"author":"Praveen Baratam",
"date":1332705307,
"popularity":1
}

Now apart from searching the docs for keywords, I want to list the
latest posts ranked by popularity and recency using popularity and
date properties of the docs.

Can we do that using ES?

Thank you.

Praveen


(vineeth mohan) #2

First you need to declare date as Date type -
http://www.elasticsearch.org/guide/reference/mapping/date-format.html
Next you need to sort based on date field for getting latest news with
match_all query type -
http://www.elasticsearch.org/guide/reference/api/search/sort.html
Use the same for popularity too.

Thanks
Vineeth

On Mon, Mar 26, 2012 at 1:35 AM, Praveen Baratam
praveen.baratam@gmail.comwrote:

Hello Everyone,

I use the following schema to store documents in ElasticSearch.

{
"id":"master-chef-america",
"title":"Master Chef - America",
"description":"Event related rant, comments and discussion..",
"author":"Praveen Baratam",
"date":1332705307,
"popularity":1
}

Now apart from searching the docs for keywords, I want to list the
latest posts ranked by popularity and recency using popularity and
date properties of the docs.

Can we do that using ES?

Thank you.

Praveen


(system) #3