The same way as the Filters section, the Aggregations section as DynamicAggregationType to hold all types of Aggregations.
It has an abstract class DynamicAgg which is being used as the base of every specific aggregation. It has an output to the UI, that's why it has a DynamicAggUI class with exclusive options regarding UI.
Anchor | ||||
---|---|---|---|---|
|
Property | Description | Default | Type | Required |
---|---|---|---|---|
type | Aggregation type | string | Yes | |
field | Name of the field from which the values will be aggregated | string | Yes | |
negated | Negates the filter | false | boolean | No |
must | Indicates if the filter must be enforced alongside other filters, or if it can be omitted if it doesn't match (acts as a should) | true | boolean | No |
post_search | Is filter multiselect? Warning: for multiselect filter, the process is done post search | false | boolean | No |
id | Name for which to identify the aggregation done | string (pattern: \w) | Yes | |
or_selection | Indicates the behavior between 2 selections of the same aggregation. If true, selections will be treated as "or" (e.g., A or B). If false, they will be treated as "and" (e.g., A and B) | true | boolean | No |
ui_only | Section dedicated for UI transformation options only. Not required for regular aggregation process | object | No | |
aggs | Nested Aggregations. Define a list of nested aggregations | array | No |
Info |
---|
The type property should be one of the following values: "term", "bool", "date_histogram", "histogram", "browse", "date_range", "range", "slider", "top_hits", or "filter". |
Property | Description | Default | Type | Required |
---|---|---|---|---|
display_name | Please use for UI display | 'Display Name' | str | Yes |
hide_count | Hides the count of the aggregation. Useful for multi-select aggregations. | False | bool | Yes |
translate | Set the description prefix for its values. (e.g main.agg.types.<value_of_agg>) | None | Optional[str] | No |
expanded | If the UI component is collapsible, indicates if it is expanded or not | True | bool | Yes |
Generate Aggregations Workflow
From the connection with the search engine, the generate_aggregations method is executed. This method originates from the Aggregation Factory class, which serves as the base for the specific Factory classes for each search engine. The generate_aggregations method receives a list of DynamicAgg objects provided by the user. This method is responsible for taking each element from that list and transforming it into the corresponding specific aggregation type. At the end of the cycle, it returns a dictionary containing all the aggregations in their specific formats.
In a similar way, the generate_aggregation_filters method inside the base_engine file, will translate the DynamicAgg objects into DynamicFilters, and finally into Engine Specific Filters.
Property | Description | Default | Type | Required |
---|---|---|---|---|
id | Name for which to identify the aggregation done | 'Aggregation Id' | str (regex: '\w') | Yes |
negated | List of values or ranges for exclusion filtering | None | List[Any] | No |
values | List of values or ranges for inclusion filtering | None | List[Any] | No |
level | Level of Deepness for histograms configuration | 0 | int | No |
SearchFilters
Property | Description | Default | Type | Required |
---|---|---|---|---|
should_not | Filter acting as a boolean operator NOR for optional exclusion. | None | list[dict] | No |
should | Filter acting as a boolean operator OR for optional inclusion. | None | list[dict] | No |
must_not | Filter acting as a boolean operator NAND for exclusion. | None | list[dict] | No |
must | Filter acting as a boolean operator AND for inclusion. | None | list[dict] | No |
post_should_not | Filter acting as a boolean operator NOR for optional exclusion after the main query. | None | list[dict] | No |
post_should | Filter acting as a boolean operator OR for optional inclusion after the main query. | None | list[dict] | No |
post_must_not | Filter acting as a boolean operator NAND for exclusion after the main query. | None | list[dict] | No |
post_must | Filter acting as a boolean operator AND for inclusion after the main query. | None | list[dict] | No |
ResponseAgg
Property | Description | Default | Type | Required |
---|---|---|---|---|
id | Unique identifier for the returned aggregation | str (alias: '_id') | Yes | |
entries | Each individual value for an aggregation |
None | list[AggEntry, Any] | No |
AggEntry
Property | Description | Default | Type | Required |
---|---|---|---|---|
count | The count of the aggregation entry | 0 | int | No |
aggs | A list of nested ResponseAgg objects, or None | None | Union[List[ResponseAgg], None] | No |