Skip to content

Sort term aggregation with nested aggregation in order path #16838

@aresn

Description

@aresn

Right now the below aggregation is not possible even though the 'nested_agg' does return a single bucket and nested aggregation is a single bucket aggregation.

Below sample aggregation generates an error message that says 'nested_agg' is not a single bucket aggregation and can not be in the order path.

{
buckets: {
terms: {
  field: 'docId',
  order: {'nested_agg>sum_value': 'desc'}
},
aggs: {
  nested_agg: {
    nested: {
      path: 'my_nested_object'
    },
    aggs: {
      sum_value: {
        sum: {field: 'my_nested_object.value'}
      }
    }
   }
  }
 }
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions