JSON string representing aggregation configuration. Structure: '{"field":"string","aggregationType":"metric|groupBy|date_range|date_histogram","options":{"size":"integer","sort":{"field":"string","order":"desc|asc","aggFunc":"total|sum|avg|max|min"},"metricFunction":"total|sum|avg|max|min","dateHistogramOptions":{"datePeriod":"hourly|daily|weekly|monthly|quarterly|yearly","hardBounds":{"min":"string","max":"string"},"extendedBounds":{"min":"string","max":"string"},"filterEmptyBuckets":"boolean"}},"aggs":{"field":"string","aggregationType":"metric|groupBy|date_range|date_histogram","options":{"metricFunction":"total|sum|avg|max|min"}}}'. metricFunction is REQUIRED when aggregationType is "metric". For aggregationType "date_histogram", options.dateHistogramOptions is REQUIRED and datePeriod, hardBounds, extendedBounds and filterEmptyBuckets all live INSIDE it — putting them directly on options is rejected with 400 "options.dateHistogramOptions" is required. The nested "aggs" is OPTIONAL and, when present, must be a JSON OBJECT with this same structure — never a JSON-encoded string.