{ "query": { "match_all": {} }, "from": 0, "size": 0, "aggs": { "itineraryId": { "terms": { "field": "iid", "size": 2147483647, "order": [ { "price>price>price.max": "desc" } ] }, "aggs": { "duration": { "stats": { "field": "drn" } }, "price": { "nested": { "path": "prl" }, "aggs": { "price": { "filter": { "terms": { "prl.cc.keyword": [ "USD" ] } }, "aggs": { "price": { "stats": { "field": "prl.spl.vl" } } } } } } } } } }
Here I get the error "Invalid way to streamline the aggregation of terms [price> price> price .max]. Terms carpets can only be sorted by the sub-aggregator path, which is built from zero or more odnokovshih clusters within the path and the final unit basket or aggregation of metrics at the end of the path. Subpath [price] indicates aggregation without a single cache "
the request works fine if I order aggregation by duration, for example
"order": [ { "duration.max": "desc" }
So, is there a way to order aggregation by nested aggregation on a nested field ie something like below?
"order": [ { "price>price>price.max": "desc" }
source share