CQAggregate (open)
Builds an aggregation query
Syntax
LOADLIB "mod::consilio/lib/api.whlib";
RECORD FUNCTION CQAggregate(STRING field, STRING type, RECORD options)Parameters
STRING fieldField to aggregate over
STRING typeAggregation type ("count", "min", "max", "terms", "top_hits", "cardinality")
RECORD optionsOptions
RECORD ARRAY aggregationsSubaggregations (returned by #CQAggregate)
STRING countfieldThe name of the field to return the number of documents containing the term in (only for
aggregation type "terms")
STRING nameName of the query, to refer to this query (defaults to the used field)
STRING orderbyField to order over (only for aggregation type "top_hits", "terms" are always sorted by
the aggregation field value)
BOOLEAN orderdescWhether to reverse the ordering (only for aggregation types "terms" and "top_hits",
defaults to FALSE for "terms" and to TRUE for "top_hits")
RECORD queryQuery to run the aggregation over (defaults to matching all documents in the index)
INTEGER sizeNr of items to return (only for aggregation types "terms" and "top_hits", defaults to -1
for "terms" to return all terms, must be a positive non-zero number for "top_hits")
Return value
RECORDConsilio aggregation query record