AggregationQueryDsl
Builds an aggregate query: its filter, the collections it expands into elements, its groups (terms, histogram, dateHistogram, datePart), its metrics, sort by group and metric aliases, limit and having. Inside an expanded element, a group or metric field is relative to the innermost element unless its scope is AggregationGroupScope.ROOT.
Functions
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun dateHistogram(field: String, unit: AggregationDateUnit, alias: String, timeZone: ZoneId = UTC, dense: Boolean = false, scope: AggregationGroupScope? = null)
fun dateHistogram(field: QueryField<*>, unit: AggregationDateUnit, alias: String, timeZone: ZoneId = UTC, dense: Boolean = false, scope: AggregationGroupScope? = null)
Link copied to clipboard
fun datePart(field: String, part: AggregationDatePart, alias: String, timeZone: ZoneId = UTC, dense: Boolean = false, scope: AggregationGroupScope? = null)
fun datePart(field: QueryField<*>, part: AggregationDatePart, alias: String, timeZone: ZoneId = UTC, dense: Boolean = false, scope: AggregationGroupScope? = null)
Link copied to clipboard
A metric computed from the other metrics of the group: derived("share") { ref("sum") / total("sum") }.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun first(field: QueryField<*>, alias: String, orderBy: QueryField<*>? = null, init: FilterDsl.() -> Unit)
Link copied to clipboard
Keeps the groups whose metrics match: having { ("count" gte 10.0) and ("sum".isNotNull()) }.
Link copied to clipboard
fun histogram(field: QueryField<*>, interval: Double, alias: String, scope: AggregationGroupScope? = null)
fun histogram(expression: AggregationExpression, interval: Double, alias: String, scope: AggregationGroupScope? = null)
Buckets the value of expression by interval.
Link copied to clipboard
fun last(field: QueryField<*>, alias: String, orderBy: QueryField<*>? = null, init: FilterDsl.() -> Unit)
Link copied to clipboard
Link copied to clipboard
fun percentile(expression: AggregationExpression, p: Double, alias: String, init: FilterDsl.() -> Unit)
Link copied to clipboard
Link copied to clipboard
Groups by the value of expression.
fun terms(field: String, alias: String, missingKey: String? = null, scope: AggregationGroupScope? = null)
scope ROOT groups the expanded elements by a field of their root record (AggregationGroup.scope).
fun terms(field: QueryField<*>, alias: String, missingKey: String? = null, scope: AggregationGroupScope? = null)
Link copied to clipboard