The tDigestSketch aggregator is capable of generating sketches from raw numeric values as well as aggregating/combining pre-generated T-Digest sketches generated using the tDigestSketch aggregator itself. While one can generate sketches on the fly during the query time itself, it generally is more performant to generate sketches during ingestion time itself and then combining them during query time. The module also provides a postAggregator, quantilesFromTDigestSketch, that can be used to compute approximate quantiles from T-Digest sketches generated by the tDigestSketch aggregator.

The result of the aggregation is a T-Digest sketch that is built ingesting numeric values from the raw data or from combining pre-generated T-Digest sketches.

  1. "type" : "tDigestSketch",
  2. "name" : <output_name>,
  3. "fieldName" : <metric_name>,
  4. "compression": <parameter that controls size and accuracy>
  5. }
  1. {
  2. "type": "tDigestSketch",
  3. "name": "combined_sketch",
  4. "compression": 200

Post Aggregators

Quantiles

This returns an array of quantiles corresponding to a given array of fractions.

  1. {
  2. "queryType": "groupBy",
  3. "dataSource": "test_datasource",
  4. "granularity": "ALL",
  5. "dimensions": [],
  6. "aggregations": [{
  7. "type": "tDigestSketch",
  8. "name": "merged_sketch",
  9. "fieldName": "ingested_sketch",
  10. "postAggregations": [{
  11. "type": "quantilesFromTDigestSketch",
  12. "name": "quantiles",
  13. "fractions": [0, 0.5, 1],
  14. "field": {
  15. "type": "fieldAccess",
  16. "fieldName": "merged_sketch"
  17. }
  18. }],
  19. "intervals": ["2016-01-01T00:00:00.000Z/2016-01-31T00:00:00.000Z"]

Similar to quantilesFromTDigestSketch except it takes in a single fraction for computing quantile.