Search for files
- async AsyncCogniteClient.files.search(
- name: str | None = None,
- filter: FileMetadataFilter | dict[str, Any] | None = None,
- limit: int = 25,
-
Deprecated since version 8.23.0: The (asset-centric) Files metadata API is deprecated and is scheduled for removal on 2027-12-31. Create and query files as CogniteFile instances in the core data model (file content upload/download remain available via instance_id). See https://docs.cognite.com/cdf/deprecated for details and migration guidance.
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:
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) ... )