Aggregate Event Property Cardinality
- async AsyncCogniteClient.events.aggregate_cardinality_properties(
- path: EventProperty | str | list[str],
- advanced_filter: Filter | dict[str, Any] | None = None,
- aggregate_filter: AggregationFilter | dict[str, Any] | None = None,
- filter: EventFilter | dict[str, Any] | None = None,
Find approximate paths count for events.
- Parameters:
path (EventPropertyLike) – The scope in every document to aggregate properties. The only value allowed now is [“metadata”]. It means to aggregate only metadata properties (aka keys).
advanced_filter (Filter | dict[str, Any] | None) – The filter to narrow down the events to count cardinality.
aggregate_filter (AggregationFilter | dict[str, Any] | None) – The filter to apply to the resulting buckets.
filter (EventFilter | dict[str, Any] | None) – The filter to narrow down the events to count requiring exact match.
- Returns:
The number of properties matching the specified filters and search.
- Return type:
int
Examples
Count the number of metadata keys for events in your CDF project:
>>> from cognite.client import CogniteClient >>> from cognite.client.data_classes.events import EventProperty >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> type_count = client.events.aggregate_cardinality_properties(EventProperty.metadata)