Skip to content

[FEATURE] Support nested sub-aggregation parser #4338

Description

@LantaoJin

Is your feature request related to a problem?
DSL https://github.com/opensearch-project/opensearch-benchmark-workloads/blob/main/big5/queries/range-auto-date-histo-with-metrics.json

{
  "size": 0,
  "aggs": {
    "tmax": {
      "range": {
        "field": "metrics.size",
        "ranges": [
          {
            "to": -10
          },
          {
            "from": -10,
            "to": 10
          },
          {
            "from": 10,
            "to": 100
          },
          {
            "from": 100,
            "to": 1000
          },
          {
            "from": 1000,
            "to": 2000
          },
          {
            "from": 2000
          }
        ]
      },
      "aggs": {
        "date": {
          "auto_date_histogram": {
            "field": "@timestamp",
            "buckets": 20
          },
          "aggs": {
            "tmin": {
              "min": {
                "field": "metrics.tmin"
              }
            },
            "tavg": {
              "avg": {
                "field": "metrics.size"
              }
            },
            "tmax": {
              "max": {
                "field": "metrics.size"
              }
            }
          }
        }
      }
    }
  }
}

requests a nested sub-aggregation parser to manipulate the pattern such as

{
  "size": 0,
  "aggs": {
    ...,
      "aggs": {
        ...,
          "aggs": {
            ...
          }
        }
      }
    }
  }
}

#4210 is to resolve the auto_date_histogram aggregation and #4201 is to resolve the range aggregation. But they cannot work together since we miss a nested sub-aggregation parser.

What solution would you like?
Composite aggregation only support terms, histogram, date-histogram, geotile_grid. For other aggregations, we have to support them via support nested sub-aggregation parser which is to manipulate

{
  "size": 0,
  "aggs": {
    ...,
      "aggs": {
        ...,
          "aggs": {
            ...
          }
        }
      }
    }
  }
}

What alternatives have you considered?
Fail with exception.

Activity

  1. added
    enhancement
    pushdown
    and removed on Sep 19, 2025
  2. self-assigned this
    on Sep 28, 2025
  3. moved this from Not Started to Done in PPL Trackeron Oct 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementpushdown

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions