Aggregate Document Unique Properties

async AsyncCogniteClient.documents.aggregate_unique_properties(
path: DocumentProperty | SourceFileProperty | list[str] | str,
query: str | None = None,
filter: Filter | dict[str, Any] | None = None,
aggregate_filter: AggregationFilter | dict[str, Any] | None = None,
limit: int = 25,
) UniqueResultList

Get unique paths with counts for documents.

Parameters:
  • path (DocumentProperty | SourceFileProperty | list[str] | str) – The scope in every document to aggregate properties. The only value allowed now is [“metadata”]. It means to aggregate only metadata properties (aka keys).

  • query (str | None) – The free text search query, for details see the documentation referenced above.

  • filter (Filter | dict[str, Any] | None) – The filter to narrow down the documents to count cardinality.

  • aggregate_filter (AggregationFilter | dict[str, Any] | None) – The filter to apply to the resulting buckets.

  • limit (int) – Maximum number of items. Defaults to 25.

Returns:

List of unique values of documents matching the specified filters and search.

Return type:

UniqueResultList

Examples

Get the unique metadata keys with count of documents in your CDF project:

>>> from cognite.client import CogniteClient
>>> from cognite.client.data_classes.documents import SourceFileProperty
>>> client = CogniteClient()
>>> # async_client = AsyncCogniteClient()  # another option
>>> result = client.documents.aggregate_unique_values(SourceFileProperty.metadata)