Aggregate Event Count
- async AsyncCogniteClient.events.aggregate_count(
- property: EventProperty | str | list[str] | None = None,
- advanced_filter: Filter | dict[str, Any] | None = None,
- filter: EventFilter | dict[str, Any] | None = None,
Count of event matching the specified filters.
- Parameters:
property (EventPropertyLike | None) – If specified, Get an approximate number of Events with a specific property (property is not null) and matching the filters.
advanced_filter (Filter | dict[str, Any] | None) – The filter to narrow down the events to count.
filter (EventFilter | dict[str, Any] | None) – The filter to narrow down the events to count requiring exact match.
- Returns:
The number of events matching the specified filters and search.
- Return type:
int
Examples
Count the number of events in your CDF project:
>>> from cognite.client import CogniteClient, AsyncCogniteClient >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> count = client.events.aggregate_count()
Count the number of workorder events in your CDF project:
>>> from cognite.client.data_classes import filters >>> from cognite.client.data_classes.events import EventProperty >>> is_workorder = filters.Equals(EventProperty.type, "workorder") >>> workorder_count = client.events.aggregate_count(advanced_filter=is_workorder)