Skip to content

Multi-field groupBy on ad-hoc aggregation #1606

@rubenvdlinde

Description

@rubenvdlinde

Deferred from: add-time-bucket-aggregation (see openspec/changes/add-time-bucket-aggregation/proposal.md Non-goals).

The first cut of the ad-hoc aggregation primitive supports exactly one groupBy.field per request. Multi-field grouping (e.g. groupBy: [status, priority]) would let charts render stacked / pivoted views without two round-trips. Out of scope for the initial PR because:

  • Most chart libraries can't render multi-dim series natively — clients typically post-process anyway.
  • Result-set size explodes: N × M buckets vs N.
  • Backend translators (Postgres GROUP BY a, b, Solr pivot.facet, ES nested terms) each need their own work.

Scope when picked up:

  • Extend AggregationQuery to accept groupBy: { fields: string[] }.
  • Extend AggregationRunner::tryNativeAggregation() for Postgres GROUP BY a, b + result reshaping.
  • Solr pivot.facet translator + ES nested terms translator.
  • GraphQL: GroupByInput.fields: [String!] (additive — keep field working for backwards-compat).
  • REST: accept comma-separated field=a,b.
  • Response shape extension: groups[i].keys: { a, b } alongside the existing flat groups[i].key for single-field requests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions