Muninn.Aggregation.Metric (Muninn v0.5.5)

View Source

Metric aggregation builders.

Metric aggregations compute numeric values (averages, sums, etc.) over document fields.

Summary

Functions

Computes the average of a numeric field.

Computes approximate distinct count using HyperLogLog.

Counts values in a field.

Computes the maximum value of a numeric field.

Computes the minimum value of a numeric field.

Computes percentiles of a numeric field.

Computes count, min, max, avg, and sum at once.

Computes the sum of a numeric field.

Functions

avg(field)

@spec avg(String.t()) :: map()

Computes the average of a numeric field.

cardinality(field, opts \\ [])

@spec cardinality(
  String.t(),
  keyword()
) :: map()

Computes approximate distinct count using HyperLogLog.

Options

  • :precision_threshold - Precision/memory trade-off (default: 3000)

count(field)

@spec count(String.t()) :: map()

Counts values in a field.

max(field)

@spec max(String.t()) :: map()

Computes the maximum value of a numeric field.

min(field)

@spec min(String.t()) :: map()

Computes the minimum value of a numeric field.

percentiles(field, opts \\ [])

@spec percentiles(
  String.t(),
  keyword()
) :: map()

Computes percentiles of a numeric field.

Options

  • :percents - List of percentile values to compute (default: [1, 5, 25, 50, 75, 95, 99])

stats(field)

@spec stats(String.t()) :: map()

Computes count, min, max, avg, and sum at once.

sum(field)

@spec sum(String.t()) :: map()

Computes the sum of a numeric field.