I'm trying to sort the resulting documents of a nested query, by another nested field. I've based this on the original documentation, but can't seem to make it work. Does anyone know what the problem might be? Here's the query that I use:
{
"query": {
"bool": {
"filter": [
{
"nested": {
"path": "properties",
"query": {
"bool": {
"filter": [
{
"match": {
"properties.key": "PROPERTY_TO_FILTER_DOCUMENTS_ON"
}
},
{
"match": {
"properties.value": "yes"
}
}
]
}
}
}
}
]
}
},
"sort": [
{
"properties.value.keyword": {
"order": "asc",
"nested": {
"path": "properties",
"filter": {
"term": {
"properties.key": "PROPERTY_TO_SORT_ON"
}
}
}
}
}
],
"size": 1000,
"_source": [
"field1",
"field2",
"field3",
"field4",
"field5"
]
}