Hi, I have been trying to sort nested documents but this solution https://www.elastic.co/guide/en/elasticsearch/reference/6.3/search-request-sort.html#nested-sorting is not what I need or at least couldn't come with my requirement for the sorting.
I need to sort the nested documents by a "date" field or "text" field inside this nested documents, subContent is my nested field.
Basically, I have something like the below structure, and I need to have the episodes for each series sorted by addDate (asc or desc)...Is it possible to do that in elastic search? working with ES 6.0.
MANY THANKS! Hope you can help me.
{
{
"id": "12345",
"title": "The series ABC",
"channelNumber": "074",
"seasonNumber": "10",
"section": "tvshows",
"subContent": [
{
"id": "576849",
"seasonNumber": "10",
"addDate": "2018-06-03T18:53:02Z",
"duration": "50 mins",
"episodeTitle": "The series ABC episode 1",
"episodeNumber": 1
},
{
"id": "48595",
"seasonNumber": "10",
"addDate": "2018-07-01T20:53:02Z",
"duration": "50 mins",
"episodeTitle": "The series ABC episode 2",
"episodeNumber": 2
},
{
"id": "294904",
"seasonNumber": "10",
"addDate": "2018-07-09T20:53:02Z",
"duration": "50 mins",
"episodeTitle": "The series ABC episode 3",
"episodeNumber": 3
}
},
{
"id": "423423",
"title": "The series DEF",
"channelNumber": "074",
"seasonNumber": "05",
"section": "tvshows",
"subContent": [
{
"id": "79696",
"seasonNumber": "10",
"addDate": "2018-05-03T18:53:02Z",
"duration": "50 mins",
"episodeTitle": "The episode series DEF 1",
"episodeNumber": 1
},
{
"id": "3434465",
"seasonNumber": "10",
"addDate": "2018-07-08T20:53:02Z",
"duration": "50 mins",
"episodeTitle": "The episode series DEF 2",
"episodeNumber": 2
},
{
"id": "687888",
"seasonNumber": "10",
"addDate": "2018-07-09T20:53:02Z",
"duration": "50 mins",
"episodeTitle": "The episode series DEF 3",
"episodeNumber": 3
}
}
}