Skip to content

Support Nested Aggregations as part of Star-Tree#18048

Merged
Bukhtawar merged 10 commits intoopensearch-project:mainfrom
Shailesh-Kumar-Singh:feature/nested-aggregations
Jun 10, 2025
Merged

Support Nested Aggregations as part of Star-Tree#18048
Bukhtawar merged 10 commits intoopensearch-project:mainfrom
Shailesh-Kumar-Singh:feature/nested-aggregations

Conversation

@Shailesh-Kumar-Singh
Copy link
Copy Markdown
Contributor

Description

Support Nested Aggregations as part of Star-Tree

Related Issues

Resolves #17274

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 16f18d9: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@codecov
Copy link
Copy Markdown

codecov bot commented Jun 6, 2025

Codecov Report

Attention: Patch coverage is 90.47619% with 6 lines in your changes missing coverage. Please review.

Project coverage is 72.70%. Comparing base (190ea02) to head (7fa0b16).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...ensearch/search/startree/StarTreeQueryContext.java 76.92% 0 Missing and 3 partials ⚠️
...ket/terms/GlobalOrdinalsStringTermsAggregator.java 90.00% 1 Missing and 1 partial ⚠️
...pensearch/search/startree/StarTreeQueryHelper.java 92.85% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #18048      +/-   ##
============================================
- Coverage     72.73%   72.70%   -0.04%     
- Complexity    67933    67987      +54     
============================================
  Files          5525     5528       +3     
  Lines        312697   312847     +150     
  Branches      45379    45418      +39     
============================================
- Hits         227449   227447       -2     
- Misses        66723    66846     +123     
- Partials      18525    18554      +29     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Shailesh-Kumar-Singh
Copy link
Copy Markdown
Contributor Author

it might be beneficial to run some benchmarks if using star-tree is beneficial or not

Benchmark -
(using nyc-taxis)

Keyword Terms + Keyword Terms Nested Aggregation -

{
  "size": 0,
  "aggs": {
    "by_vendor": {
      "terms": {
        "field": "rate_code_id"
      },
      "aggs": {
        "by_trip_type": {
          "terms": {
            "field": "trip_type"
          },
          "aggs": {
            "total_tips": {
              "sum": {
                "field": "tolls_amount"
              }
            }
          }
        }
      }
    }
  }
}

With Star Tree Enabled - 55 ms (First Run), 25 ms (Second Run)
Without Star Tree - 5975 ms (First Run), 4446 ms (Second Run)

Keyword + DateHistogram Nested Aggregation -

{
  "size": 0,
  "aggs": {
    "by_passenger_count": {
      "terms": {
        "field": "passenger_count"
      },
      "aggs": {
        "by_hour": {
          "date_histogram": {
            "field": "dropoff_datetime",
            "calendar_interval": "hour"
          },
          "aggs": {
            "sum_total_amount": {
              "sum": {
                "field": "total_amount"
              }
            }
          }
        }
      }
    }
  }
}

With Star Tree Enabled - 6792 ms (First Run), 6714 ms (Second Run)
Without Star Tree - 25069 ms (First Run), 24701 (Second Run)

4 LEVELS -
keyword + range(numeric) + date_histogram + value_count(numeric)

{
  "size": 0,
  "aggs": {
    "by_rate_code": {
      "terms": {
        "field": "rate_code_id"
      },
      "aggs": {
        "fare_ranges": {
          "range": {
            "field": "passenger_count",
            "ranges": [
              { "to": 5 },
              { "from": 5, "to": 20 },
              { "from": 20 }
            ]
          },
          "aggs": {
            "by_hour": {
              "date_histogram": {
                "field": "dropoff_datetime",
                "calendar_interval": "hour"
              },
              "aggs": {
                "count_trips": {
                  "value_count": {
                    "field": "trip_distance"
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

With Star Tree Enabled - 5812 ms (First Run), 5522 ms (Second Run)
Without Star Tree - 25063 ms (First Run), 25587 (Second Run)

Signed-off-by: Shailesh Singh <shaikumm@amazon.com>
@Shailesh-Kumar-Singh Shailesh-Kumar-Singh force-pushed the feature/nested-aggregations branch from 5433f7c to 61ff5f8 Compare June 10, 2025 07:23
Copy link
Copy Markdown
Contributor

@expani expani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can take up the comments around design and performance post this PR.

@github-actions
Copy link
Copy Markdown
Contributor

✅ Gradle check result for 61ff5f8: SUCCESS

…ations - resolve merge conflicts

Signed-off-by: Shailesh Singh <shaikumm@amazon.com>
@Shailesh-Kumar-Singh Shailesh-Kumar-Singh force-pushed the feature/nested-aggregations branch from a1ff61d to 669a589 Compare June 10, 2025 12:54
Signed-off-by: Shailesh Singh <shaikumm@amazon.com>
@shwetathareja
Copy link
Copy Markdown
Member

Helping with merge. It has already been approved by multiple folks working on Star tree feature.

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 7fa0b16: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Copy Markdown
Contributor

❕ Gradle check result for 7fa0b16: UNSTABLE

Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.

@Bukhtawar Bukhtawar merged commit 6fd9329 into opensearch-project:main Jun 10, 2025
63 of 66 checks passed
abhita pushed a commit to abhita/OpenSearch that referenced this pull request Jun 17, 2025
…18048)

* Support Nested Aggregations as part of Star-Tree

Signed-off-by: Shailesh Singh <shaikumm@amazon.com>
neuenfeldttj pushed a commit to neuenfeldttj/OpenSearch that referenced this pull request Jun 26, 2025
…18048)

* Support Nested Aggregations as part of Star-Tree

Signed-off-by: Shailesh Singh <shaikumm@amazon.com>Signed-off-by: TJ Neuenfeldt <tjneu@amazon.com>
neuenfeldttj pushed a commit to neuenfeldttj/OpenSearch that referenced this pull request Jun 26, 2025
…18048)

* Support Nested Aggregations as part of Star-Tree

Signed-off-by: Shailesh Singh <shaikumm@amazon.com>
tandonks pushed a commit to tandonks/OpenSearch that referenced this pull request Aug 5, 2025
…18048)

* Support Nested Aggregations as part of Star-Tree

Signed-off-by: Shailesh Singh <shaikumm@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Enhancement or improvement to existing feature or request Search:Aggregations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Star Tree] [Search] Nested Bucket Aggregations

6 participants