Search for files

async AsyncCogniteClient.files.search(
name: str | None = None,
filter: FileMetadataFilter | dict[str, Any] | None = None,
limit: int = 25,
) FileMetadataList

Search for files.

Primarily meant for human-centric use-cases and data exploration, not for programs, since matching and ordering may change over time. Use the list function if stable or exact matches are required.

Parameters:
  • name (str | None) – Prefix and fuzzy search on name.

  • filter (FileMetadataFilter | dict[str, Any] | None) – Filter to apply. Performs exact match on these fields.

  • limit (int) – Max number of results to return.

Returns:

List of requested files metadata.

Return type:

FileMetadataList

Examples

Search for a file:

>>> from cognite.client import CogniteClient, AsyncCogniteClient
>>> client = CogniteClient()
>>> # async_client = AsyncCogniteClient()  # another option
>>> res = client.files.search(name="some name")

Search for an asset with an attached label:

>>> my_label_filter = LabelFilter(contains_all=["WELL LOG"])
>>> res = client.assets.search(
...     name="xyz", filter=FileMetadataFilter(labels=my_label_filter)
... )