Reputation: 21
In elasticsearch 1.5.0, I try to sort/order the aggregation bucket using scripted_metric result,but receive bellow error:
AggregationExecutionException[Invalid terms aggregation order path [custom_script]. Terms buckets can only be sorted on a sub-aggregator path that is built out of zero or more single-bucket aggregations within the path and a final single-bucket or a metrics aggregation at the path end
is any way to solve this issue?
my query like this:
"aggs": {
"mygroup": {
"terms": {
"field": "customername",
"order": {
"custom_script": "asc"
}
},
"aggs": {
"custom_script": {
"scripted_metric": {
...
}
}
}
}
}
Upvotes: 2
Views: 2014
Reputation: 751
Nope, it's a current limitation. Being tracked in https://github.com/elastic/elasticsearch/issues/8486
Upvotes: 3