Sampler aggregation

Sampler aggregation #

A single-bucket aggregation that keeps only a sample of the matching documents before running its sub-aggregations — used to cut aggregation cost on very large result sets.

Example #

Sample 60 documents, then count types inside the sample:

Parameters for sampler #

  • shard_size
    (Optional, integer, default: 100000) Sample size per shard.
  • aggs
    (Optional, object) Sub-aggregations computed over the sample.
Calendar September 26, 2026
Edit Edit this page