Suppose I've a very simple index. Blog post
and blog categories
. One blog belong to one or more categories.
I want to find for each category the last 3 posts. How can I do this ? I've read about "Field collapsing" here https://www.elastic.co/guide/en/elasticsearch/guide/current/top-hits.html but the example refers to a scalar field, I've a collection.
A document could be:
{ "title" : "My post",
"categories" : [{ "tech" => "Technology", "professional" => "Professional"]
},
{ "title" : "My secondo post",
"categories" : [{ "professional" => "Professional"]
},