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] Range Aggregations with metric aggregation #16553

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 range aggregations with metric aggregations.

Example query shape:

{ "size": 0,
    "aggs": {
        "low_value": {
            "range": {
                "field": "status",
                "ranges": [
                    {
                        "from": 198,
                        "to": 201
                    },
                    {
                        "from": 202,
                        "to": 203
                    },
                    {
                        "from": 204,
                        "to": 401
                    }
                ]
            },
            "aggs": {
                "sum_status": {
                    "sum": {
                        "field": "status"
                    }
                }
            }
        }
    }
}

Describe the solution you'd like

Vanilla rag aggregations with no metric aggregations are already optimized and would most likely not benefit from star-tree optimization. Its specifically where metric aggregations (sum, min, max, avg) are required, those cases would gain performance benefits.

Related component

Search:Aggregations

Describe alternatives you've considered

No response

Additional context

No response