opensearch-project / OpenSearch

🔎 Open source distributed and RESTful search engine.
https://opensearch.org/docs/latest/opensearch/index/
Apache License 2.0
9.84k stars 1.83k forks source link

[Star Tree] [Search] Bucket terms Aggregation with metric aggregation #16551

Open sandeshkr419 opened 2 weeks ago

sandeshkr419 commented 2 weeks ago

Is your feature request related to a problem? Please describe

This is to support bucket aggregations (single-level) with metric aggregations.

Example query shape:

{
    "size": 0,
    "aggs": {
        "response_codes": {
            "terms": {
                "field": "status",
                "size": 100
            },
            "aggs": {
                "sum_status": {
                    "sum": {
                        "field": "status"
                    }
                }
            }
        }
    }
}

Describe the solution you'd like

Vanilla bucket aggregations on keyword fields with no metric aggregations are already optimized and would most likely not benefit from star-tree optimization. Its for numeric fields, where metric aggregations (sum, min, max, avg) would gain performance benefits.

Related component

Search:Aggregations

Describe alternatives you've considered

No response

Additional context

No response