CQAggregate (open)
Builds an aggregation query
Syntax
LOADLIB "mod::consilio/lib/api.whlib";
RECORD FUNCTION CQAggregate(STRING field, STRING type, RECORD options)
Parameters
STRING field
Field to aggregate over
STRING type
Aggregation type ("count"
, "min"
, "max"
, "terms"
, "top_hits"
, "cardinality"
)
RECORD options
Options
RECORD ARRAY aggregations
Subaggregations (returned by #CQAggregate)
STRING countfield
The name of the field to return the number of documents containing the term in (only for
aggregation type "terms"
)
STRING name
Name of the query, to refer to this query (defaults to the used field)
STRING orderby
Field to order over (only for aggregation type "top_hits"
, "terms"
are always sorted by
the aggregation field value)
BOOLEAN orderdesc
Whether to reverse the ordering (only for aggregation types "terms"
and "top_hits"
,
defaults to FALSE for "terms"
and to TRUE for "top_hits"
)
RECORD query
Query to run the aggregation over (defaults to matching all documents in the index)
INTEGER size
Nr 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
RECORD
Consilio aggregation query record