Class GetDocumentStats

java.lang.Object
io.fluxcapacitor.common.api.Request
io.fluxcapacitor.common.api.search.GetDocumentStats
All Implemented Interfaces:
JsonType

public class GetDocumentStats extends Request
Request to compute statistics on documents that match a given SearchQuery.

This operation supports flexible aggregations on arbitrary document fields, including numeric ranges, value frequencies, and groupings. It can be used, for example, to calculate total counts, averages, or distributions grouped by specified field(s).

Performance note: This request is typically resolved in-memory by the Flux platform. As a result, it may be expensive to execute for large result sets or unindexed fields.

If you only need count statistics for fields explicitly marked with Facet, consider using GetFacetStats instead. That variant leverages the backing document store and is significantly more efficient.

Example use cases:

  • Calculate how many documents exist per status code or country.
  • Group average document sizes by collection name.
  • Compute time-based activity levels based on a createdAt timestamp.
See Also:
  • Constructor Details

    • GetDocumentStats

      public GetDocumentStats()