I have documents which look like this:
{
"parent" : {
"properties" : {
"id": {
"type" : "keyword"
}
"name" : {
"type" : "keyword"
}
}
}
}
and child documents:
{
"child": {
"_parent": {
"type": "parent"
},
"_routing": {
"required": true
},
"properties": {
"child_id": {
"type" : "keyword"
},
"child_name" : {
"type" : "keyword"
},
"child_time": {
"type": "date"
}
}
}
}
How can I sort parent documents by child_name of child with the latest child_time?
I cannot explain the details, because I dont understand them yet, but I found this workaround:
https://www.elastic.co/guide/en/elasticsearch/reference/5.0/query-dsl-has-child-query.html#_sorting
The according feature-request, which would provide an explicit way to sort by value on child-documents, was closed: https://github.com/elastic/elasticsearch/issues/2917
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.