Reputation: 4332
My elastic search mapping of "tags" has nested Videos array of objects
When i do a match_all query, all the tags are returned, and each tag has many videos attached.
I want to limit it to only X videos returned. How can I paginate the nested objects?
Upvotes: 1
Views: 1335
Reputation: 4728
take a look at inner hits with size
option : https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-inner-hits.html
try something like this
{
"_source": false,
"fields":["your_fields"],
"size": 10,
"query": {
"match_all": {}
},
"inner_hits" : {
"comments" : {
"path" : {
"comments" : {
"size":5,
"query" : {
"match_all": {}
}
}
}
}
}
}
Upvotes: 2