Hi @RAMBOURG Pierre!
thank you for the detailed reproduction, that helps to understand the issue you are facing.
I had a look at the SDK code and filter() and list(advanced_filter=...) are functionally equivalent, as they produce identical API calls under the hood. The only difference is that filter() is deprecated and will be removed in a future SDK version, so I'd recommend switching to list(advanced_filter=...) going forward. But this is not causing your issue.
I extended my test covering all three approaches:
- SDK
filter() - SDK
list(advanced_filter=...) - raw API
POST /timeseries/list
I also tested the scenario of updating a time series to remove its asset_id. All cases work as expected on my project, including the Not(Exists(asset_id)) filter correctly finding time series with null asset_id.
Given your evidence, with asset_id confirmed to be None via both retrieve() and the UI, created_time == last_updated_time (never modified), and the TS is found by the dataset filter but not by Not(Exists(asset_id)), this points to a server-side search index inconsistency for specific time series in your project.
You can confirm this is a server-side issue (not SDK) by running the equivalent raw API call:
resp = client.post(
url=f"/api/v1/projects/{client.config.project}/timeseries/list",
json={
"advancedFilter": {
"and": [
{"equals": {"property": ["dataSetId"], "value": 7443233575990547}},
{"not": {"exists": {"property": ["assetId"]}}},
]
},
"limit": 100,
},
)
items = resp.json()["items"]
found = any(i["externalId"] == "OPCUA-230115-i=6692" for i in items)
print(f"Found via raw API: {found}")
If this also returns False, it confirms the search index is stale for this TS and I'd recommend filing a support ticket with Cognite, referencing time series ID 5064386156929082 and dataset 7443233575990547. The support team will have to investigate.