Muninn.Aggregation.Bucket (Muninn v0.5.5)
View SourceBucket aggregation builders.
Bucket aggregations group documents into buckets based on field values, ranges, or other criteria.
Summary
Functions
Filters documents for sub-aggregations.
Groups documents into fixed-width numeric buckets.
Groups documents by numeric ranges.
Groups documents by field values.
Functions
Filters documents for sub-aggregations.
Examples
Bucket.filter(%{"term" => %{"status" => "active"}})
Groups documents into fixed-width numeric buckets.
Options
:offset- Bucket boundary offset:min_doc_count- Minimum document count
Examples
Bucket.histogram("price", 10.0)
Groups documents by numeric ranges.
Examples
Bucket.range("price", [
%{"to" => 50.0},
%{"from" => 50.0, "to" => 100.0},
%{"from" => 100.0}
])
Groups documents by field values.
Options
:size- Maximum number of buckets to return:min_doc_count- Minimum document count for a bucket to be included:order- Sort order for buckets (e.g.,%{"_count" => "asc"})
Examples
Bucket.terms("category", size: 10)